From: <arj...@us...> - 2008-08-25 04:29:14
|
Revision: 8709 http://plplot.svn.sourceforge.net/plplot/?rev=8709&view=rev Author: arjenmarkus Date: 2008-08-25 04:29:24 +0000 (Mon, 25 Aug 2008) Log Message: ----------- Implemented a first version of plgriddataCmd() - data are still not transferred correctly Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2008-08-24 10:05:39 UTC (rev 8708) +++ trunk/bindings/tcl/tclAPI.c 2008-08-25 04:29:24 UTC (rev 8709) @@ -63,6 +63,7 @@ static int plmeridiansCmd (ClientData, Tcl_Interp *, int, const char **); static int plvectCmd (ClientData, Tcl_Interp *, int, const char **); static int plranddCmd (ClientData, Tcl_Interp *, int, const char **); +static int plgriddataCmd (ClientData, Tcl_Interp *, int, const char **); /* * The following structure defines all of the commands in the PLplot/Tcl @@ -102,6 +103,7 @@ {"plshades", plshadesCmd}, {"plvect", plvectCmd}, {"plrandd", plranddCmd}, + {"plgriddata", plgriddataCmd}, {NULL, NULL} }; @@ -2911,3 +2913,92 @@ plflush(); return TCL_OK; } + +/*--------------------------------------------------------------------------*\ + * plgriddataCmd + * + * Processes plgriddata Tcl command. +\*--------------------------------------------------------------------------*/ +static int +plgriddataCmd( ClientData clientData, Tcl_Interp *interp, + int argc, const char *argv[] ) +{ + tclMatrix *arrx, *arry, *arrz, *xcoord, *ycoord, *zvalue; + PLINT pts, nx, ny, alg; + PLFLT optalg; + PLFLT **z; + + int i, j; + + if (argc != 9 ) { + Tcl_AppendResult( interp, "wrong # args: see documentation for ", + argv[0], (char *) NULL); + return TCL_ERROR; + } + + arrx = Tcl_GetMatrixPtr(interp, argv[1]); + arry = Tcl_GetMatrixPtr(interp, argv[2]); + arrz = Tcl_GetMatrixPtr(interp, argv[3]); + + xcoord = Tcl_GetMatrixPtr(interp, argv[4]); + ycoord = Tcl_GetMatrixPtr(interp, argv[5]); + + zvalue = Tcl_GetMatrixPtr(interp, argv[6]); + + sscanf( argv[7], "%d", &alg); + sscanf( argv[8], "%g", &optalg); + + if (arrx == NULL || arrx->dim != 1) { + Tcl_AppendResult(interp, argv[0], ": argument 1 should be a \ +one-dimensional matrix - ", argv[1], (char *) NULL); + return TCL_ERROR; + } + if (arry == NULL || arry->dim != 1) { + Tcl_AppendResult(interp, argv[0], ": argument 2 should be a \ +one-dimensional matrix - ", argv[2], (char *) NULL); + return TCL_ERROR; + } + if (arrz == NULL || arrz->dim != 1) { + Tcl_AppendResult(interp, argv[0], ": argument 3 should be a \ +one-dimensional matrix - ", argv[3], (char *) NULL); + return TCL_ERROR; + } + + if (xcoord == NULL || xcoord->dim != 1) { + Tcl_AppendResult(interp, argv[0], ": argument 4 should be a \ +one-dimensional matrix - ", argv[4], (char *) NULL); + return TCL_ERROR; + } + if (ycoord == NULL || ycoord->dim != 1) { + Tcl_AppendResult(interp, argv[0], ": argument 5 should be a \ +one-dimensional matrix - ", argv[5], (char *) NULL); + return TCL_ERROR; + } + if (zvalue == NULL || zvalue->dim != 2) { + Tcl_AppendResult(interp, argv[0], ": argument 6 should be a \ +two-dimensional matrix - ", argv[6], (char *) NULL); + return TCL_ERROR; + } + + pts = arrx->n[0]; + nx = zvalue->n[0]; + ny = zvalue->n[1]; + + /* convert zvalue to 2d-array so can use standard wrap approach + * from now on in this code. */ + plAlloc2dGrid(&z, nx, ny ); + + /* Interpolate the data */ + plgriddata( arrx->fdata, arry->fdata, arrz->fdata, pts, + xcoord->fdata, nx, ycoord->fdata, ny, z, alg, optalg ); + + /* Copy the result into the matrix */ + for (i=0; i < nx; i++) { + for (j=0; j < ny; j++) { + zvalue->fdata[j+zvalue->n[1]*i] = z[i][j]; + } + } + + plFree2dGrid( z, nx, ny ); + return TCL_OK; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2008-08-30 06:55:51
|
Revision: 8721 http://plplot.svn.sourceforge.net/plplot/?rev=8721&view=rev Author: arjenmarkus Date: 2008-08-30 06:56:00 +0000 (Sat, 30 Aug 2008) Log Message: ----------- Added commands plimage and plimagefr Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2008-08-28 18:03:57 UTC (rev 8720) +++ trunk/bindings/tcl/tclAPI.c 2008-08-30 06:56:00 UTC (rev 8721) @@ -64,6 +64,8 @@ static int plvectCmd (ClientData, Tcl_Interp *, int, const char **); static int plranddCmd (ClientData, Tcl_Interp *, int, const char **); static int plgriddataCmd (ClientData, Tcl_Interp *, int, const char **); +static int plimageCmd (ClientData, Tcl_Interp *, int, const char **); +static int plimagefrCmd(ClientData, Tcl_Interp *, int, const char **); /* * The following structure defines all of the commands in the PLplot/Tcl @@ -104,6 +106,8 @@ {"plvect", plvectCmd}, {"plrandd", plranddCmd}, {"plgriddata", plgriddataCmd}, + {"plimage", plimageCmd}, + {"plimagefr", plimageCmd}, {NULL, NULL} }; @@ -2928,6 +2932,7 @@ PLFLT optalg; PLFLT **z; + double value; int i, j; if (argc != 9 ) { @@ -2946,8 +2951,9 @@ zvalue = Tcl_GetMatrixPtr(interp, argv[6]); sscanf( argv[7], "%d", &alg); - sscanf( argv[8], "%g", &optalg); + sscanf( argv[8], "%lg", &value); optalg = (PLFLT)value; + if (arrx == NULL || arrx->dim != 1) { Tcl_AppendResult(interp, argv[0], ": argument 1 should be a \ one-dimensional matrix - ", argv[1], (char *) NULL); @@ -3002,3 +3008,167 @@ plFree2dGrid( z, nx, ny ); return TCL_OK; } + +/*--------------------------------------------------------------------------*\ + * plimageCmd + * + * Processes plimage Tcl command. +\*--------------------------------------------------------------------------*/ +static int +plimageCmd( ClientData clientData, Tcl_Interp *interp, + int argc, const char *argv[] ) +{ + tclMatrix *zvalue; + PLINT nx, ny; + PLFLT **pidata; + PLFLT xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, Dymin, Dymax; + + double value; + int i, j; + + if (argc != 12 ) { + Tcl_AppendResult( interp, "wrong # args: see documentation for ", + argv[0], (char *) NULL); + return TCL_ERROR; + } + + zvalue = Tcl_GetMatrixPtr(interp, argv[1]); + + if (zvalue == NULL || zvalue->dim != 2) { + Tcl_AppendResult(interp, argv[0], ": argument 1 should be a \ +two-dimensional matrix - ", argv[1], (char *) NULL); + return TCL_ERROR; + } + + sscanf( argv[2], "%lg", &value); xmin = (PLFLT)value; + sscanf( argv[3], "%lg", &value); xmax = (PLFLT)value; + sscanf( argv[4], "%lg", &value); ymin = (PLFLT)value; + sscanf( argv[5], "%lg", &value); ymax = (PLFLT)value; + sscanf( argv[6], "%lg", &value); zmin = (PLFLT)value; + sscanf( argv[7], "%lg", &value); zmax = (PLFLT)value; + sscanf( argv[8], "%lg", &value); Dxmin = (PLFLT)value; + sscanf( argv[9], "%lg", &value); Dxmax = (PLFLT)value; + sscanf( argv[10], "%lg", &value); Dymin = (PLFLT)value; + sscanf( argv[11], "%lg", &value); Dymax = (PLFLT)value; + + printf( "xmin, etc.: %f %f\n", (float)xmin, (float)xmax ); + printf( "ymin, etc.: %f %f\n", (float)ymin, (float)ymax ); + printf( "zmin, etc.: %f %f\n", (float)zmin, (float)zmax ); + printf( "Dxmin, etc.: %f %f\n", (float)Dxmin, (float)Dxmax ); + printf( "Dymin, etc.: %f %f\n", (float)Dymin, (float)Dymax ); + + nx = zvalue->n[0]; + ny = zvalue->n[1]; + + plAlloc2dGrid(&pidata, nx, ny); + + for ( i = 0 ; i < nx ; i ++ ) { + for ( j = 0 ; j < ny ; j ++ ) { + pidata[i][j] = zvalue->fdata[j + i * ny]; + } + } + + c_plimage(pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, + Dxmin, Dxmax, Dymin, Dymax); + + plFree2dGrid(pidata, nx, ny); + + return TCL_OK; +} + +/*--------------------------------------------------------------------------*\ + * plimagefrCmd + * + * Processes plimagefr Tcl command. + * + * Note: + * Very basic! No user-defined interpolation routines +\*--------------------------------------------------------------------------*/ +static int +plimagefrCmd( ClientData clientData, Tcl_Interp *interp, + int argc, const char *argv[] ) +{ + tclMatrix *zvalue; + tclMatrix *xg; + tclMatrix *yg; + PLINT nx, ny; + PLFLT **pidata; + PLcGrid cgrid; + PLFLT xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax; + + double value; + int i, j; + + if (argc != 12 && argc != 10) { + Tcl_AppendResult( interp, "wrong # args: see documentation for ", + argv[0], (char *) NULL); + return TCL_ERROR; + } + + zvalue = Tcl_GetMatrixPtr(interp, argv[1]); + + if (zvalue == NULL || zvalue->dim != 2) { + Tcl_AppendResult(interp, argv[0], ": argument 1 should be a \ +two-dimensional matrix - ", argv[1], (char *) NULL); + return TCL_ERROR; + } + + xg = NULL; + yg = NULL; + if (argc == 12) { + xg = Tcl_GetMatrixPtr(interp, argv[10]); + yg = Tcl_GetMatrixPtr(interp, argv[11]); + + if (xg == NULL || xg->dim != 1) { + Tcl_AppendResult(interp, argv[0], ": argument 10 should be a \ +one-dimensional matrix - ", argv[10], (char *) NULL); + return TCL_ERROR; + } + + if (yg == NULL || yg->dim != 1) { + Tcl_AppendResult(interp, argv[0], ": argument 11 should be a \ +one-dimensional matrix - ", argv[11], (char *) NULL); + return TCL_ERROR; + } + } + + sscanf( argv[2], "%lg", &value); xmin = (PLFLT)value; + sscanf( argv[3], "%lg", &value); xmax = (PLFLT)value; + sscanf( argv[4], "%lg", &value); ymin = (PLFLT)value; + sscanf( argv[5], "%lg", &value); ymax = (PLFLT)value; + sscanf( argv[6], "%lg", &value); zmin = (PLFLT)value; + sscanf( argv[7], "%lg", &value); zmax = (PLFLT)value; + sscanf( argv[8], "%lg", &value); valuemin = (PLFLT)value; + sscanf( argv[9], "%lg", &value); valuemax = (PLFLT)value; + + nx = zvalue->n[0]; + ny = zvalue->n[1]; + + printf( "xmin, etc.: %f %f\n", (float)xmin, (float)xmax ); + printf( "ymin, etc.: %f %f\n", (float)ymin, (float)ymax ); + printf( "zmin, etc.: %f %f\n", (float)zmin, (float)zmax ); + printf( "valuemin, etc.: %f %f\n", (float)valuemin, (float)valuemax ); + + + plAlloc2dGrid(&pidata, nx, ny); + + for ( i = 0 ; i < nx ; i ++ ) { + for ( j = 0 ; j < ny ; j ++ ) { + pidata[i][j] = zvalue->fdata[j + i * ny]; + } + } + + if (xg != NULL) { + cgrid.nx = nx+1; + cgrid.ny = ny+1; + cgrid.xg = xg; + cgrid.yg = yg; + c_plimagefr(pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, + valuemin, valuemax, pltr1, (void *) &cgrid); + } else { + c_plimagefr(pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, + valuemin, valuemax, pltr0, NULL); + } + + plFree2dGrid(pidata, nx, ny); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2009-12-10 20:19:02
|
Revision: 10718 http://plplot.svn.sourceforge.net/plplot/?rev=10718&view=rev Author: airwin Date: 2009-12-10 20:18:54 +0000 (Thu, 10 Dec 2009) Log Message: ----------- Get rid of memory leaks that would occur for error conditions. (Issue found by cppcheck). Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2009-12-10 19:53:30 UTC (rev 10717) +++ trunk/bindings/tcl/tclAPI.c 2009-12-10 20:18:54 UTC (rev 10718) @@ -640,6 +640,7 @@ pls_auto_path( Tcl_Interp *interp ) { char *buf, *ptr = NULL, *dn; + int return_code = TCL_OK; #ifdef DEBUG char *path; #endif @@ -651,7 +652,10 @@ #ifdef TCL_DIR Tcl_SetVar( interp, "dir", TCL_DIR, TCL_GLOBAL_ONLY ); if ( tcl_cmd( interp, "set auto_path \"$dir $auto_path\"" ) == TCL_ERROR ) - return TCL_ERROR; + { + return_code = TCL_ERROR; + goto finish; + } #ifdef DEBUG fprintf( stderr, "adding %s to auto_path\n", TCL_DIR ); path = Tcl_GetVar( interp, "auto_path", 0 ); @@ -666,7 +670,10 @@ plGetName( dn, "tcl", "", &ptr ); Tcl_SetVar( interp, "dir", ptr, 0 ); if ( tcl_cmd( interp, "set auto_path \"$dir $auto_path\"" ) == TCL_ERROR ) - return TCL_ERROR; + { + return_code = TCL_ERROR; + goto finish; + } #ifdef DEBUG fprintf( stderr, "adding %s to auto_path\n", ptr ); path = Tcl_GetVar( interp, "auto_path", 0 ); @@ -682,7 +689,10 @@ plGetName( dn, "", "", &ptr ); Tcl_SetVar( interp, "dir", ptr, 0 ); if ( tcl_cmd( interp, "set auto_path \"$dir $auto_path\"" ) == TCL_ERROR ) - return TCL_ERROR; + { + return_code = TCL_ERROR; + goto finish; + } #ifdef DEBUG fprintf( stderr, "adding %s to auto_path\n", ptr ); path = Tcl_GetVar( interp, "auto_path", 0 ); @@ -699,7 +709,10 @@ plGetName( dn, "tcl", "", &ptr ); Tcl_SetVar( interp, "dir", ptr, 0 ); if ( tcl_cmd( interp, "set auto_path \"$dir $auto_path\"" ) == TCL_ERROR ) - return TCL_ERROR; + { + return_code = TCL_ERROR; + goto finish; + } #ifdef DEBUG fprintf( stderr, "adding %s to auto_path\n", ptr ); path = Tcl_GetVar( interp, "auto_path", 0 ); @@ -713,19 +726,26 @@ if ( getcwd( buf, 256 ) == 0 ) { Tcl_SetResult( interp, "Problems with getcwd in pls_auto_path", TCL_STATIC ); - return TCL_ERROR; + { + return_code = TCL_ERROR; + goto finish; + } } - Tcl_SetVar( interp, "dir", buf, 0 ); if ( tcl_cmd( interp, "set auto_path \"$dir $auto_path\"" ) == TCL_ERROR ) - return TCL_ERROR; - + { + return_code = TCL_ERROR; + goto finish; + } /*** see if plserver was invoked in the build tree ***/ if ( plInBuildTree()) { Tcl_SetVar( interp, "dir", BUILD_DIR "/bindings/tk", TCL_GLOBAL_ONLY ); if ( tcl_cmd( interp, "set auto_path \"$dir $auto_path\"" ) == TCL_ERROR ) - return TCL_ERROR; + { + return_code = TCL_ERROR; + goto finish; + } } #ifdef DEBUG @@ -734,10 +754,10 @@ fprintf( stderr, "auto_path is %s\n", path ); #endif - free_mem( buf ); +finish: free_mem( buf ); free_mem( ptr ); - return TCL_OK; + return return_code; } /*----------------------------------------------------------------------*\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2010-05-03 04:51:57
|
Revision: 10963 http://plplot.svn.sourceforge.net/plplot/?rev=10963&view=rev Author: airwin Date: 2010-05-03 04:51:51 +0000 (Mon, 03 May 2010) Log Message: ----------- Allow the exact string "NULL" as a pltr argument possibility in the user-friendly variants of plshade and plshades. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2010-05-03 02:03:13 UTC (rev 10962) +++ trunk/bindings/tcl/tclAPI.c 2010-05-03 04:51:51 UTC (rev 10963) @@ -2494,13 +2494,13 @@ * We will be getting data through a 2-d Matrix, which carries along * nx and ny, so no need for those. Toss defined since it's not supported * anyway. Toss plfill since it is the only valid choice. Take an optional - * pltr spec just as for plcont, and add a wrapping specifier, also just as - * in plcont. So the new command looks like: + * pltr spec just as for plcont or an alternative of NULL pltr, and add a + * wrapping specifier, as in plcont. So the new command looks like: * * plshade z xmin xmax ymin ymax \ * sh_min sh_max sh_cmap sh_color sh_width \ * min_col min_wid max_col max_wid \ - * rect [pltr x y] [wrap] + * rect [[pltr x y] | NULL ] [wrap] \*--------------------------------------------------------------------------*/ static int @@ -2581,6 +2581,11 @@ argc -= 3, argv += 3; } + else if ( argc && !strcmp( argv[0], "NULL" ) ) + { + pltrname = argv[0]; + argc -= 1, argv += 1; + } if ( argc ) { @@ -2597,8 +2602,20 @@ /* Figure out which coordinate transformation model is being used, and setup * accordingly. */ - if ( !strcmp( pltrname, "pltr0" ) ) + if ( !strcmp( pltrname, "NULL" ) ) { + pltr = NULL; + zused = z; + + /* wrapping is only supported for pltr2. */ + if ( wrap ) + { + interp->result = "Must use pltr2 if want wrapping."; + return TCL_ERROR; + } + } + else if ( !strcmp( pltrname, "pltr0" ) ) + { pltr = pltr0; zused = z; @@ -2743,7 +2760,7 @@ { Tcl_AppendResult( interp, "Unrecognized coordinate transformation spec:", - pltrname, ", must be pltr0 pltr1 or pltr2.", + pltrname, ", must be NULL, pltr0, pltr1, or pltr2.", (char *) NULL ); return TCL_ERROR; } @@ -2794,13 +2811,13 @@ * nx and ny, so no need for those. Toss defined since it's not supported * anyway. clevel will be via a 1-d matrix, which carries along nlevel, so * no need for that. Toss plfill since it is the only valid choice. - * Take an optional - * pltr spec just as for plcont, and add a wrapping specifier, also just as - * in plcont. So the new command looks like: + * Take an optional pltr spec just as for plcont or an alternative of + * NULL pltr, and add a wrapping specifier, as in plcont. + * So the new command looks like: * * plshades z xmin xmax ymin ymax \ * clevel, fill_width, cont_color, cont_width\ - * rect [pltr x y] [wrap] + * rect [[pltr x y] | NULL] [wrap] \*--------------------------------------------------------------------------*/ static int @@ -2884,6 +2901,11 @@ argc -= 3, argv += 3; } + else if ( argc && !strcmp( argv[0], "NULL" ) ) + { + pltrname = argv[0]; + argc -= 1, argv += 1; + } if ( argc ) { @@ -2900,8 +2922,20 @@ /* Figure out which coordinate transformation model is being used, and setup * accordingly. */ - if ( !strcmp( pltrname, "pltr0" ) ) + if ( !strcmp( pltrname, "NULL" ) ) { + pltr = NULL; + zused = z; + + /* wrapping is only supported for pltr2. */ + if ( wrap ) + { + interp->result = "Must use pltr2 if want wrapping."; + return TCL_ERROR; + } + } + else if ( !strcmp( pltrname, "pltr0" ) ) + { pltr = pltr0; zused = z; @@ -3046,7 +3080,7 @@ { Tcl_AppendResult( interp, "Unrecognized coordinate transformation spec:", - pltrname, ", must be pltr0 pltr1 or pltr2.", + pltrname, ", must be NULL, pltr0, pltr1, or pltr2.", (char *) NULL ); return TCL_ERROR; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2010-12-21 08:38:38
|
Revision: 11381 http://plplot.svn.sourceforge.net/plplot/?rev=11381&view=rev Author: arjenmarkus Date: 2010-12-21 08:38:29 +0000 (Tue, 21 Dec 2010) Log Message: ----------- Solve bug 3140457 - replace the code that accessed the Tcl internals by a call to Tcl_SetResult(). Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2010-12-20 22:29:38 UTC (rev 11380) +++ trunk/bindings/tcl/tclAPI.c 2010-12-21 08:38:29 UTC (rev 11381) @@ -155,7 +155,7 @@ //-------------------------------------------------------------------------- // Append_Cmdlist // -// Generates command list from Cmds, storing into interp->result. +// Generates command list from Cmds, storing as interps result. //-------------------------------------------------------------------------- static void @@ -626,7 +626,7 @@ if ( Tcl_ExprBoolean( interp, argv[1], &result ) ) { fprintf( stderr, "wait_until command \"%s\" failed:\n\t %s\n", - argv[1], interp->result ); + argv[1], Tcl_GetStringResult(interp) ); break; } if ( result ) @@ -788,7 +788,7 @@ if ( result != TCL_OK ) { fprintf( stderr, "TCL command \"%s\" failed:\n\t %s\n", - cmd, interp->result ); + cmd, Tcl_GetStringResult(interp) ); } return result; } @@ -884,7 +884,7 @@ if ( matf->dim != 2 ) { - interp->result = "Must use 2-d data."; + Tcl_SetResult( interp, "Must use 2-d data.", TCL_STATIC ); return TCL_ERROR; } else @@ -918,7 +918,7 @@ // Check that there are enough args if ( argc < 7 ) { - interp->result = "plcont, bogus syntax"; + Tcl_SetResult( interp, "plcont, bogus syntax", TCL_STATIC ); return TCL_ERROR; } @@ -940,7 +940,7 @@ if ( argc < 1 ) { - interp->result = "plcont, bogus syntax"; + Tcl_SetResult( interp, "plcont, bogus syntax", TCL_STATIC ); return TCL_ERROR; } @@ -951,7 +951,7 @@ if ( matclev->dim != 1 ) { - interp->result = "clev must be 1-d matrix."; + Tcl_SetResult( interp, "clev must be 1-d matrix.", TCL_STATIC ); return TCL_ERROR; } @@ -988,7 +988,7 @@ if ( argc ) { - interp->result = "plcont, bogus syntax, too many args."; + Tcl_SetResult( interp, "plcont, bogus syntax, too many args.", TCL_STATIC ); return TCL_ERROR; } @@ -1002,7 +1002,7 @@ // wrapping is only supported for pltr2. if ( wrap ) { - interp->result = "Must use pltr2 if want wrapping."; + Tcl_SetResult( interp, "Must use pltr2 if want wrapping.", TCL_STATIC ); return TCL_ERROR; } } @@ -1018,13 +1018,13 @@ // wrapping is only supported for pltr2. if ( wrap ) { - interp->result = "Must use pltr2 if want wrapping."; + Tcl_SetResult( interp, "Must use pltr2 if want wrapping.", TCL_STATIC ); return TCL_ERROR; } if ( mattrx->dim != 1 || mattry->dim != 1 ) { - interp->result = "Must use 1-d coord arrays with pltr1."; + Tcl_SetResult( interp, "Must use 1-d coord arrays with pltr1.", TCL_STATIC ); return TCL_ERROR; } @@ -1128,8 +1128,7 @@ } else { - interp->result = - "Invalid wrap specifier, must be <empty>, 0, 1, or 2."; + Tcl_SetResult( interp, "Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC ); return TCL_ERROR; } @@ -1222,7 +1221,7 @@ if ( matu->dim != 2 ) { - interp->result = "Must use 2-d data."; + Tcl_SetResult( interp, "Must use 2-d data.", TCL_STATIC ); return TCL_ERROR; } else @@ -1250,7 +1249,7 @@ if ( matv->dim != 2 ) { - interp->result = "Must use 2-d data."; + Tcl_SetResult( interp, "Must use 2-d data.", TCL_STATIC ); return TCL_ERROR; } else @@ -1278,7 +1277,7 @@ if ( argc < 1 ) { - interp->result = "plvect, bogus syntax"; + Tcl_SetResult( interp, "plvect, bogus syntax", TCL_STATIC ); return TCL_ERROR; } @@ -1316,7 +1315,7 @@ if ( argc ) { - interp->result = "plvect, bogus syntax, too many args."; + Tcl_SetResult( interp, "plvect, bogus syntax, too many args.", TCL_STATIC ); return TCL_ERROR; } @@ -1331,7 +1330,7 @@ // wrapping is only supported for pltr2. if ( wrap ) { - interp->result = "Must use pltr2 if want wrapping."; + Tcl_SetResult( interp, "Must use pltr2 if want wrapping.", TCL_STATIC ); return TCL_ERROR; } } @@ -1348,13 +1347,13 @@ // wrapping is only supported for pltr2. if ( wrap ) { - interp->result = "Must use pltr2 if want wrapping."; + Tcl_SetResult( interp, "Must use pltr2 if want wrapping.", TCL_STATIC ); return TCL_ERROR; } if ( mattrx->dim != 1 || mattry->dim != 1 ) { - interp->result = "Must use 1-d coord arrays with pltr1."; + Tcl_SetResult( interp, "Must use 1-d coord arrays with pltr1.", TCL_STATIC ); return TCL_ERROR; } @@ -1472,8 +1471,7 @@ } else { - interp->result = - "Invalid wrap specifier, must be <empty>, 0, 1, or 2."; + Tcl_SetResult( interp, "Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC ); return TCL_ERROR; } @@ -1565,7 +1563,7 @@ maty->type != TYPE_FLOAT || matz->type != TYPE_FLOAT ) { - interp->result = "x y and z must all be float"; + Tcl_SetResult( interp, "x y and z must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -1573,7 +1571,7 @@ maty->dim != 1 || maty->n[0] != ny || matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -1603,7 +1601,7 @@ maty->type != TYPE_FLOAT || matz->type != TYPE_FLOAT ) { - interp->result = "x y and z must all be float"; + Tcl_SetResult( interp, "x y and z must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -1613,7 +1611,7 @@ maty->dim != 1 || maty->n[0] != ny || matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -1626,7 +1624,7 @@ } else if ( argc == 3 ) { - interp->result = "unimplemented"; + Tcl_SetResult( interp, "unimplemented", TCL_STATIC ); return TCL_ERROR; } else @@ -1711,7 +1709,7 @@ matz->type != TYPE_FLOAT || matlev->type != TYPE_FLOAT ) { - interp->result = "x y z and clevel must all be float"; + Tcl_SetResult( interp, "x y z and clevel must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -1720,7 +1718,7 @@ matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny || matlev->dim != 1 || matlev->n[0] != nlev ) { - interp->result = "popo Inconsistent dimensions"; + Tcl_SetResult( interp, "popo Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -1758,7 +1756,7 @@ matz->type != TYPE_FLOAT || matlev->type != TYPE_FLOAT ) { - interp->result = "x y z and clevel must all be float"; + Tcl_SetResult( interp, "x y z and clevel must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -1767,7 +1765,7 @@ matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny || matlev->dim != 1 || matlev->n[0] != nlev ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -1803,7 +1801,7 @@ maty->type != TYPE_FLOAT || matz->type != TYPE_FLOAT ) { - interp->result = "x y and z must all be float"; + Tcl_SetResult( interp, "x y and z must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -1811,7 +1809,7 @@ maty->dim != 1 || maty->n[0] != ny || matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -1842,7 +1840,7 @@ maty->type != TYPE_FLOAT || matz->type != TYPE_FLOAT ) { - interp->result = "x y and z must all be float"; + Tcl_SetResult( interp, "x y and z must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -1852,7 +1850,7 @@ maty->dim != 1 || maty->n[0] != ny || matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -1865,7 +1863,7 @@ } else if ( argc == 3 ) { - interp->result = "unimplemented"; + Tcl_SetResult( interp, "unimplemented", TCL_STATIC ); return TCL_ERROR; } else @@ -1940,7 +1938,7 @@ maty->type != TYPE_FLOAT || matz->type != TYPE_FLOAT ) { - interp->result = "x y and z must all be float"; + Tcl_SetResult( interp, "x y and z must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -1948,7 +1946,7 @@ maty->dim != 1 || maty->n[0] != ny || matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -1979,7 +1977,7 @@ maty->type != TYPE_FLOAT || matz->type != TYPE_FLOAT ) { - interp->result = "x y and z must all be float"; + Tcl_SetResult( interp, "x y and z must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -1989,7 +1987,7 @@ maty->dim != 1 || maty->n[0] != ny || matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -2002,7 +2000,7 @@ } else if ( argc == 4 ) { - interp->result = "unimplemented"; + Tcl_SetResult( interp, "unimplemented", TCL_STATIC ); return TCL_ERROR; } else @@ -2087,7 +2085,7 @@ matz->type != TYPE_FLOAT || matlev->type != TYPE_FLOAT ) { - interp->result = "x y z and clevel must all be float"; + Tcl_SetResult( interp, "x y z and clevel must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -2096,7 +2094,7 @@ matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny || matlev->dim != 1 || matlev->n[0] != nlev ) { - interp->result = "popo Inconsistent dimensions"; + Tcl_SetResult( interp, "popo Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -2134,7 +2132,7 @@ matz->type != TYPE_FLOAT || matlev->type != TYPE_FLOAT ) { - interp->result = "x y z and clevel must all be float"; + Tcl_SetResult( interp, "x y z and clevel must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -2143,7 +2141,7 @@ matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny || matlev->dim != 1 || matlev->n[0] != nlev ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -2179,7 +2177,7 @@ maty->type != TYPE_FLOAT || matz->type != TYPE_FLOAT ) { - interp->result = "x y and z must all be float"; + Tcl_SetResult( interp, "x y and z must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -2187,7 +2185,7 @@ maty->dim != 1 || maty->n[0] != ny || matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -2218,7 +2216,7 @@ maty->type != TYPE_FLOAT || matz->type != TYPE_FLOAT ) { - interp->result = "x y and z must all be float"; + Tcl_SetResult( interp, "x y and z must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -2228,7 +2226,7 @@ maty->dim != 1 || maty->n[0] != ny || matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -2241,7 +2239,7 @@ } else if ( argc == 3 ) { - interp->result = "unimplemented"; + Tcl_SetResult( interp, "unimplemented", TCL_STATIC ); return TCL_ERROR; } else @@ -2326,7 +2324,7 @@ matz->type != TYPE_FLOAT || matlev->type != TYPE_FLOAT ) { - interp->result = "x y z and clevel must all be float"; + Tcl_SetResult( interp, "x y z and clevel must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -2335,7 +2333,7 @@ matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny || matlev->dim != 1 || matlev->n[0] != nlev ) { - interp->result = "popo Inconsistent dimensions"; + Tcl_SetResult( interp, "popo Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -2373,7 +2371,7 @@ matz->type != TYPE_FLOAT || matlev->type != TYPE_FLOAT ) { - interp->result = "x y z and clevel must all be float"; + Tcl_SetResult( interp, "x y z and clevel must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -2382,7 +2380,7 @@ matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny || matlev->dim != 1 || matlev->n[0] != nlev ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -2418,7 +2416,7 @@ maty->type != TYPE_FLOAT || matz->type != TYPE_FLOAT ) { - interp->result = "x y and z must all be float"; + Tcl_SetResult( interp, "x y and z must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -2426,7 +2424,7 @@ maty->dim != 1 || maty->n[0] != ny || matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -2457,7 +2455,7 @@ maty->type != TYPE_FLOAT || matz->type != TYPE_FLOAT ) { - interp->result = "x y and z must all be float"; + Tcl_SetResult( interp, "x y and z must all be float", TCL_STATIC ); return TCL_ERROR; } @@ -2467,7 +2465,7 @@ maty->dim != 1 || maty->n[0] != ny || matz->dim != 2 || matz->n[0] != nx || matz->n[1] != ny ) { - interp->result = "Inconsistent dimensions"; + Tcl_SetResult( interp, "Inconsistent dimensions", TCL_STATIC ); return TCL_ERROR; } @@ -2480,7 +2478,7 @@ } else if ( argc == 3 ) { - interp->result = "unimplemented"; + Tcl_SetResult( interp, "unimplemented", TCL_STATIC ); return TCL_ERROR; } else @@ -2611,7 +2609,7 @@ return TCL_ERROR; if ( matz->dim != 2 ) { - interp->result = "Must plot a 2-d matrix."; + Tcl_SetResult( interp, "Must plot a 2-d matrix.", TCL_STATIC ); return TCL_ERROR; } @@ -2675,7 +2673,7 @@ if ( argc ) { - interp->result = "plshade: bogus arg list"; + Tcl_SetResult( interp, "plshade: bogus arg list", TCL_STATIC ); return TCL_ERROR; } @@ -2690,7 +2688,7 @@ // wrapping is only supported for pltr2. if ( wrap ) { - interp->result = "Must use pltr2 if want wrapping."; + Tcl_SetResult( interp, "Must use pltr2 if want wrapping.", TCL_STATIC ); return TCL_ERROR; } } @@ -2702,7 +2700,7 @@ // wrapping is only supported for pltr2. if ( wrap ) { - interp->result = "Must use pltr2 if want wrapping."; + Tcl_SetResult( interp, "Must use pltr2 if want wrapping.", TCL_STATIC ); return TCL_ERROR; } } @@ -2718,13 +2716,13 @@ // wrapping is only supported for pltr2. if ( wrap ) { - interp->result = "Must use pltr2 if want wrapping."; + Tcl_SetResult( interp, "Must use pltr2 if want wrapping.", TCL_STATIC ); return TCL_ERROR; } if ( mattrx->dim != 1 || mattry->dim != 1 ) { - interp->result = "Must use 1-d coord arrays with pltr1."; + Tcl_SetResult( interp, "Must use 1-d coord arrays with pltr1.", TCL_STATIC ); return TCL_ERROR; } @@ -2828,8 +2826,7 @@ } else { - interp->result = - "Invalid wrap specifier, must be <empty>, 0, 1, or 2."; + Tcl_SetResult( interp, "Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC ); return TCL_ERROR; } @@ -2932,7 +2929,7 @@ return TCL_ERROR; if ( matz->dim != 2 ) { - interp->result = "Must plot a 2-d matrix."; + Tcl_SetResult( interp, "Must plot a 2-d matrix.", TCL_STATIC ); return TCL_ERROR; } @@ -2964,7 +2961,7 @@ nlevel = matclevel->n[0]; if ( matclevel->dim != 1 ) { - interp->result = "clevel must be 1-d matrix."; + Tcl_SetResult( interp, "clevel must be 1-d matrix.", TCL_STATIC ); return TCL_ERROR; } @@ -3001,7 +2998,7 @@ if ( argc ) { - interp->result = "plshades: bogus arg list"; + Tcl_SetResult( interp, "plshades: bogus arg list", TCL_STATIC ); return TCL_ERROR; } @@ -3016,7 +3013,7 @@ // wrapping is only supported for pltr2. if ( wrap ) { - interp->result = "Must use pltr2 if want wrapping."; + Tcl_SetResult( interp, "Must use pltr2 if want wrapping.", TCL_STATIC ); return TCL_ERROR; } } @@ -3028,7 +3025,7 @@ // wrapping is only supported for pltr2. if ( wrap ) { - interp->result = "Must use pltr2 if want wrapping."; + Tcl_SetResult( interp, "Must use pltr2 if want wrapping.", TCL_STATIC ); return TCL_ERROR; } } @@ -3044,13 +3041,13 @@ // wrapping is only supported for pltr2. if ( wrap ) { - interp->result = "Must use pltr2 if want wrapping."; + Tcl_SetResult( interp, "Must use pltr2 if want wrapping.", TCL_STATIC ); return TCL_ERROR; } if ( mattrx->dim != 1 || mattry->dim != 1 ) { - interp->result = "Must use 1-d coord arrays with pltr1."; + Tcl_SetResult( interp, "Must use 1-d coord arrays with pltr1.", TCL_STATIC ); return TCL_ERROR; } @@ -3154,8 +3151,7 @@ } else { - interp->result = - "Invalid wrap specifier, must be <empty>, 0, 1, or 2."; + Tcl_SetResult( interp, "Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC ); return TCL_ERROR; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2008-08-30 11:13:12
|
Revision: 8725 http://plplot.svn.sourceforge.net/plplot/?rev=8725&view=rev Author: arjenmarkus Date: 2008-08-30 11:13:21 +0000 (Sat, 30 Aug 2008) Log Message: ----------- Repaired a few mistakes in plimagefr Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2008-08-30 07:32:51 UTC (rev 8724) +++ trunk/bindings/tcl/tclAPI.c 2008-08-30 11:13:21 UTC (rev 8725) @@ -107,7 +107,7 @@ {"plrandd", plranddCmd}, {"plgriddata", plgriddataCmd}, {"plimage", plimageCmd}, - {"plimagefr", plimageCmd}, + {"plimagefr", plimagefrCmd}, {NULL, NULL} }; @@ -3051,12 +3051,6 @@ sscanf( argv[10], "%lg", &value); Dymin = (PLFLT)value; sscanf( argv[11], "%lg", &value); Dymax = (PLFLT)value; - printf( "xmin, etc.: %f %f\n", (float)xmin, (float)xmax ); - printf( "ymin, etc.: %f %f\n", (float)ymin, (float)ymax ); - printf( "zmin, etc.: %f %f\n", (float)zmin, (float)zmax ); - printf( "Dxmin, etc.: %f %f\n", (float)Dxmin, (float)Dxmax ); - printf( "Dymin, etc.: %f %f\n", (float)Dymin, (float)Dymax ); - nx = zvalue->n[0]; ny = zvalue->n[1]; @@ -3091,10 +3085,10 @@ tclMatrix *zvalue; tclMatrix *xg; tclMatrix *yg; - PLINT nx, ny; - PLFLT **pidata; - PLcGrid cgrid; - PLFLT xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax; + PLINT nx, ny; + PLFLT **pidata; + PLcGrid2 cgrid2; + PLFLT xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax; double value; int i, j; @@ -3119,15 +3113,15 @@ xg = Tcl_GetMatrixPtr(interp, argv[10]); yg = Tcl_GetMatrixPtr(interp, argv[11]); - if (xg == NULL || xg->dim != 1) { + if (xg == NULL || xg->dim != 2) { Tcl_AppendResult(interp, argv[0], ": argument 10 should be a \ -one-dimensional matrix - ", argv[10], (char *) NULL); +two-dimensional matrix - ", argv[10], (char *) NULL); return TCL_ERROR; } - if (yg == NULL || yg->dim != 1) { + if (yg == NULL || yg->dim != 2) { Tcl_AppendResult(interp, argv[0], ": argument 11 should be a \ -one-dimensional matrix - ", argv[11], (char *) NULL); +two-dimensional matrix - ", argv[11], (char *) NULL); return TCL_ERROR; } } @@ -3144,12 +3138,6 @@ nx = zvalue->n[0]; ny = zvalue->n[1]; - printf( "xmin, etc.: %f %f\n", (float)xmin, (float)xmax ); - printf( "ymin, etc.: %f %f\n", (float)ymin, (float)ymax ); - printf( "zmin, etc.: %f %f\n", (float)zmin, (float)zmax ); - printf( "valuemin, etc.: %f %f\n", (float)valuemin, (float)valuemax ); - - plAlloc2dGrid(&pidata, nx, ny); for ( i = 0 ; i < nx ; i ++ ) { @@ -3159,16 +3147,29 @@ } if (xg != NULL) { - cgrid.nx = nx+1; - cgrid.ny = ny+1; - cgrid.xg = xg; - cgrid.yg = yg; + plAlloc2dGrid(&cgrid2.xg, nx+1, ny+1); + plAlloc2dGrid(&cgrid2.yg, nx+1, ny+1); + + cgrid2.nx = nx+1; + cgrid2.ny = ny+1; + for ( i = 0 ; i <= nx ; i ++ ) { + for ( j = 0 ; j <= ny ; j ++ ) { + cgrid2.xg[i][j] = xg->fdata[j + i * (ny+1)]; + cgrid2.yg[i][j] = yg->fdata[j + i * (ny+1)]; + } + } c_plimagefr(pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, - valuemin, valuemax, pltr1, (void *) &cgrid); + valuemin, valuemax, pltr2, (void *) &cgrid2); } else { c_plimagefr(pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax, pltr0, NULL); } plFree2dGrid(pidata, nx, ny); + if (xg != NULL) { + plFree2dGrid(cgrid2.xg, nx+1, ny+1); + plFree2dGrid(cgrid2.yg, nx+1, ny+1); + } + + return TCL_OK; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-10-09 14:51:32
|
Revision: 8869 http://plplot.svn.sourceforge.net/plplot/?rev=8869&view=rev Author: smekal Date: 2008-10-09 14:51:30 +0000 (Thu, 09 Oct 2008) Log Message: ----------- Changed all PLDLLEXPORT macros to the correct PLDLLIMPEXP macro to allow compilation of static libraries on Win32. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2008-10-09 14:49:07 UTC (rev 8868) +++ trunk/bindings/tcl/tclAPI.c 2008-10-09 14:51:30 UTC (rev 8869) @@ -517,7 +517,7 @@ * interfacing to PLplot. Should not be used in a widget-based system. \*--------------------------------------------------------------------------*/ -int PLDLLEXPORT +int PLDLLIMPEXP Pltcl_Init( Tcl_Interp *interp ) { register CmdInfo *cmdInfoPtr; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2009-01-02 12:22:08
|
Revision: 9244 http://plplot.svn.sourceforge.net/plplot/?rev=9244&view=rev Author: arjenmarkus Date: 2009-01-02 11:41:23 +0000 (Fri, 02 Jan 2009) Log Message: ----------- Corrected DLL export/import macro for Windows Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2009-01-02 11:39:23 UTC (rev 9243) +++ trunk/bindings/tcl/tclAPI.c 2009-01-02 11:41:23 UTC (rev 9244) @@ -126,7 +126,7 @@ #define PL_LIBRARY "" #endif -extern char PLDLLIMPEXP_TCLTK * plplotLibDir; +extern PLDLLIMPORT char * plplotLibDir; #if (!defined(MAC_TCL) && !defined(__WIN32__)) /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2009-01-13 20:58:58
|
Revision: 9298 http://plplot.svn.sourceforge.net/plplot/?rev=9298&view=rev Author: arjenmarkus Date: 2009-01-13 20:58:51 +0000 (Tue, 13 Jan 2009) Log Message: ----------- Tcl API expanded and slightly revised, so that the plmap and plmeridians commands optionally take a procedure name as their first argument. This procedure can then perform the coordinate transformation. Note: the implementation could possibly be optimised, as now the matrix commands are created with each invocation of the transformation procedure. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2009-01-13 12:50:08 UTC (rev 9297) +++ trunk/bindings/tcl/tclAPI.c 2009-01-13 20:58:51 UTC (rev 9298) @@ -2822,18 +2822,69 @@ * x[], y[] are the coordinates to be plotted. \*--------------------------------------------------------------------------*/ +static char *transform_name; /* Name of the procedure that transforms the + coordinates */ +static Tcl_Interp *tcl_interp; /* Pointer to the current interp */ +static int return_code; /* Saved return code */ + void mapform(PLINT n, PLFLT *x, PLFLT *y) { int i; double xp, yp, radius; + char *cmd; + tclMatrix *xPtr, *yPtr; + + cmd = (char *) malloc( strlen(transform_name) + 40); + + /* Build the (new) matrix commands and fill the matrices */ + sprintf(cmd, "matrix %cx f %d", (char)1, n); + if (Tcl_Eval(tcl_interp, cmd) != TCL_OK) { + return_code = TCL_ERROR; + free(cmd); + return; + } + sprintf(cmd, "matrix %cy f %d", (char)1, n); + if (Tcl_Eval(tcl_interp, cmd) != TCL_OK) { + return_code = TCL_ERROR; + free(cmd); + return; + } + + sprintf(cmd, "%cx", (char)1); + xPtr = Tcl_GetMatrixPtr(tcl_interp, cmd); + sprintf(cmd, "%cy", (char)1); + yPtr = Tcl_GetMatrixPtr(tcl_interp, cmd); + + if (xPtr == NULL || yPtr == NULL ) return; /* Impossible, but still */ + for (i = 0; i < n; i++) { - radius = 90.0 - y[i]; - xp = radius * cos(x[i] * PI / 180.0); - yp = radius * sin(x[i] * PI / 180.0); - x[i] = xp; - y[i] = yp; + xPtr->fdata[i] = x[i]; + yPtr->fdata[i] = y[i]; } + + /* Now call the Tcl procedure to do the work */ + sprintf(cmd, "%s %d %cx %cy", transform_name, n, (char)1, (char)1); + return_code = Tcl_Eval(tcl_interp, cmd); + if (return_code != TCL_OK) { + free(cmd); + return; + } + + /* Don't forget to copy the results back into the original arrays + */ + for (i = 0; i < n; i++) { + x[i] = xPtr->fdata[i] ; + y[i] = yPtr->fdata[i] ; + } + + /* Clean up, otherwise the next call will fail - [matrix] does not + overwrite existing commands + */ + sprintf(cmd, "rename %cx {}; rename %cy {}", (char)1, (char)1); + return_code = Tcl_Eval(tcl_interp, cmd); + + free(cmd); } /*--------------------------------------------------------------------------*\ @@ -2852,27 +2903,48 @@ { PLFLT minlong, maxlong, minlat, maxlat; PLINT transform; + PLINT idxname; + char cmd[40]; - if (argc < 7 ) { + return_code = TCL_OK; + if (argc < 6 || argc > 7) { Tcl_AppendResult(interp, "bogus syntax for plmap, see doc.", (char *) NULL ); return TCL_ERROR; } - transform = atoi(argv[2]); - minlong = atof( argv[3] ); - maxlong = atof( argv[4] ); - minlat = atof( argv[5] ); - maxlat = atof( argv[6] ); + if ( argc == 6 ) { + transform = 0; + idxname = 1; + transform_name = NULL; + minlong = atof( argv[2] ); + maxlong = atof( argv[3] ); + minlat = atof( argv[4] ); + maxlat = atof( argv[5] ); + } else { + transform = 1; + idxname = 2; + minlong = atof( argv[3] ); + maxlong = atof( argv[4] ); + minlat = atof( argv[5] ); + maxlat = atof( argv[6] ); - if (transform) { - plmap(&mapform, argv[1], minlong, maxlong, minlat, maxlat); + tcl_interp = interp; + transform_name = argv[1]; + if (strlen(transform_name) == 0) { + idxname = 1; + } + } + + if (transform && idxname == 2) { + plmap(&mapform, argv[idxname], minlong, maxlong, minlat, maxlat); } else { - plmap(NULL, argv[1], minlong, maxlong, minlat, maxlat); + /* No transformation given */ + plmap(NULL, argv[idxname], minlong, maxlong, minlat, maxlat); } plflush(); - return TCL_OK; + return return_code; } /*--------------------------------------------------------------------------*\ @@ -2892,20 +2964,39 @@ PLFLT dlong, dlat, minlong, maxlong, minlat, maxlat; PLINT transform; - if (argc < 8 ) { - Tcl_AppendResult(interp, "bogus syntax for plmap, see doc.", + return_code = TCL_OK; + + if (argc < 7 || argc > 8) { + Tcl_AppendResult(interp, "bogus syntax for plmeridians, see doc.", (char *) NULL ); return TCL_ERROR; } - transform = atoi(argv[1]); - dlong = atof( argv[2] ); - dlat = atof( argv[3] ); - minlong = atof( argv[4] ); - maxlong = atof( argv[5] ); - minlat = atof( argv[6] ); - maxlat = atof( argv[7] ); + if ( argc == 7 ) { + transform = 0; + transform_name = NULL; + dlong = atof( argv[1] ); + dlat = atof( argv[2] ); + minlong = atof( argv[3] ); + maxlong = atof( argv[4] ); + minlat = atof( argv[5] ); + maxlat = atof( argv[6] ); + } else { + dlong = atof( argv[2] ); + dlat = atof( argv[3] ); + minlong = atof( argv[4] ); + maxlong = atof( argv[5] ); + minlat = atof( argv[6] ); + maxlat = atof( argv[7] ); + transform = 1; + tcl_interp = interp; + transform_name = argv[1]; + if (strlen(transform_name) == 0) { + transform = 0; + } + } + if (transform) { plmeridians(&mapform, dlong, dlat, minlong, maxlong, minlat, maxlat); } else { @@ -3060,6 +3151,13 @@ } } + fprintf(stderr,"nx, ny: %d %d\n", nx, ny); + fprintf(stderr,"xmin, xmax: %.17g %.17g\n", xmin, xmax); + fprintf(stderr,"ymin, ymax: %.17g %.17g\n", ymin, ymax); + fprintf(stderr,"zmin, zmax: %.17g %.17g\n", zmin, zmax); + fprintf(stderr,"Dxmin, Dxmax: %.17g %.17g\n", Dxmin, Dxmax); + fprintf(stderr,"Dymin, Dymax: %.17g %.17g\n", Dymin, Dymax); + c_plimage(pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, Dymin, Dymax); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-01-14 10:02:30
|
Revision: 9303 http://plplot.svn.sourceforge.net/plplot/?rev=9303&view=rev Author: andrewross Date: 2009-01-14 10:02:28 +0000 (Wed, 14 Jan 2009) Log Message: ----------- Make transform name a const string (it is) which fixes gcc warning when compiling tclAPI.c. Comment out debugging fprintf messages. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2009-01-14 09:59:00 UTC (rev 9302) +++ trunk/bindings/tcl/tclAPI.c 2009-01-14 10:02:28 UTC (rev 9303) @@ -2822,7 +2822,7 @@ * x[], y[] are the coordinates to be plotted. \*--------------------------------------------------------------------------*/ -static char *transform_name; /* Name of the procedure that transforms the +static const char *transform_name; /* Name of the procedure that transforms the coordinates */ static Tcl_Interp *tcl_interp; /* Pointer to the current interp */ static int return_code; /* Saved return code */ @@ -3150,13 +3150,14 @@ pidata[i][j] = zvalue->fdata[j + i * ny]; } } - + /* fprintf(stderr,"nx, ny: %d %d\n", nx, ny); fprintf(stderr,"xmin, xmax: %.17g %.17g\n", xmin, xmax); fprintf(stderr,"ymin, ymax: %.17g %.17g\n", ymin, ymax); fprintf(stderr,"zmin, zmax: %.17g %.17g\n", zmin, zmax); fprintf(stderr,"Dxmin, Dxmax: %.17g %.17g\n", Dxmin, Dxmax); fprintf(stderr,"Dymin, Dymax: %.17g %.17g\n", Dymin, Dymax); + */ c_plimage(pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, Dymin, Dymax); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2009-01-16 11:12:49
|
Revision: 9324 http://plplot.svn.sourceforge.net/plplot/?rev=9324&view=rev Author: andrewross Date: 2009-01-16 11:12:39 +0000 (Fri, 16 Jan 2009) Log Message: ----------- Fix const modifier for char arrays in plstripc function. Removes gcc warning messages. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2009-01-16 11:11:54 UTC (rev 9323) +++ trunk/bindings/tcl/tclAPI.c 2009-01-16 11:12:39 UTC (rev 9324) @@ -3282,9 +3282,9 @@ { int i; int id; - char *xspec; - char *yspec; - char *idName; + const char *xspec; + const char *yspec; + const char *idName; tclMatrix *colMat; tclMatrix *styleMat; double value; @@ -3294,10 +3294,10 @@ PLINT colbox, collab; PLINT colline[4], styline[4]; int nlegend; - char **legline; - char *labx; - char *laby; - char *labtop; + const char **legline; + const char *labx; + const char *laby; + const char *labtop; char idvalue[20]; if (argc != 21) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-03-01 20:12:50
|
Revision: 10836 http://plplot.svn.sourceforge.net/plplot/?rev=10836&view=rev Author: andrewross Date: 2010-03-01 20:12:43 +0000 (Mon, 01 Mar 2010) Log Message: ----------- Fix handling of the auto_path list variable in tcl. This fixes plplot bug #2960318. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2010-03-01 20:07:25 UTC (rev 10835) +++ trunk/bindings/tcl/tclAPI.c 2010-03-01 20:12:43 UTC (rev 10836) @@ -651,7 +651,7 @@ #ifdef TCL_DIR Tcl_SetVar( interp, "dir", TCL_DIR, TCL_GLOBAL_ONLY ); - if ( tcl_cmd( interp, "set auto_path [list $dir $auto_path]" ) == TCL_ERROR ) + if ( tcl_cmd( interp, "set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR ) { return_code = TCL_ERROR; goto finish; @@ -669,7 +669,7 @@ { plGetName( dn, "tcl", "", &ptr ); Tcl_SetVar( interp, "dir", ptr, 0 ); - if ( tcl_cmd( interp, "set auto_path [list $dir $auto_path]" ) == TCL_ERROR ) + if ( tcl_cmd( interp, "set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR ) { return_code = TCL_ERROR; goto finish; @@ -688,7 +688,7 @@ { plGetName( dn, "", "", &ptr ); Tcl_SetVar( interp, "dir", ptr, 0 ); - if ( tcl_cmd( interp, "set auto_path [list $dir $auto_path]" ) == TCL_ERROR ) + if ( tcl_cmd( interp, "set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR ) { return_code = TCL_ERROR; goto finish; @@ -708,7 +708,7 @@ { plGetName( dn, "tcl", "", &ptr ); Tcl_SetVar( interp, "dir", ptr, 0 ); - if ( tcl_cmd( interp, "set auto_path [list $dir $auto_path]" ) == TCL_ERROR ) + if ( tcl_cmd( interp, "set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR ) { return_code = TCL_ERROR; goto finish; @@ -732,7 +732,7 @@ } } Tcl_SetVar( interp, "dir", buf, 0 ); - if ( tcl_cmd( interp, "set auto_path [list $dir $auto_path]" ) == TCL_ERROR ) + if ( tcl_cmd( interp, "set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR ) { return_code = TCL_ERROR; goto finish; @@ -741,7 +741,7 @@ if ( plInBuildTree() ) { Tcl_SetVar( interp, "dir", BUILD_DIR "/bindings/tk", TCL_GLOBAL_ONLY ); - if ( tcl_cmd( interp, "set auto_path [list $dir $auto_path]" ) == TCL_ERROR ) + if ( tcl_cmd( interp, "set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR ) { return_code = TCL_ERROR; goto finish; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fu...@us...> - 2010-05-12 17:31:54
|
Revision: 10992 http://plplot.svn.sourceforge.net/plplot/?rev=10992&view=rev Author: furnish Date: 2010-05-12 17:31:47 +0000 (Wed, 12 May 2010) Log Message: ----------- For Tcl versions less than 8.5, back down to multiple uses of lindex to extract the result coords. We could do it this way for all Tcl versions, but the lassign technique introduced in Tcl 8.5 is surely more efficient. Tcl example 19 now works with both Tcl/Tk 8.5 and 8.4. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2010-05-12 02:09:41 UTC (rev 10991) +++ trunk/bindings/tcl/tclAPI.c 2010-05-12 17:31:47 UTC (rev 10992) @@ -3332,7 +3332,12 @@ static Tcl_Interp *tcl_xform_interp = 0; static char *tcl_xform_procname = 0; static const char *tcl_xform_template = - "set result [%s ${_##_x} ${_##_y}] ; lassign $result _##_x _##_y"; +#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 5 + "set result [%s ${_##_x} ${_##_y}] ; set _##_x [lindex $result 0] ; set _##_y [lindex $result 1]" +#else + "set result [%s ${_##_x} ${_##_y}] ; lassign $result _##_x _##_y" +#endif + ; static char *tcl_xform_code = 0; @@ -3353,6 +3358,10 @@ "_##_y", NULL, objy, 0 ); Tcl_DecrRefCount( objy ); +/* printf( "objx=%x objy=%x\n", objx, objy ); */ + +/* printf( "Evaluating code: %s\n", tcl_xform_code ); */ + // Call identified Tcl proc. Forget data, Tcl can use namespaces and custom // procs to manage transmission of the custom client data. // Proc should return a two element list which is xt yt. @@ -3361,6 +3370,8 @@ if ( code != TCL_OK ) { printf( "Unable to evaluate Tcl-side coordinate transform.\n" ); + printf( "code = %d\n", code ); + printf( "Error result: %s\n", Tcl_GetStringResult( tcl_xform_interp ) ); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2010-05-27 09:51:17
|
Revision: 11025 http://plplot.svn.sourceforge.net/plplot/?rev=11025&view=rev Author: andrewross Date: 2010-05-27 09:51:11 +0000 (Thu, 27 May 2010) Log Message: ----------- Fix tcl support for NULL argument to plstransform. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2010-05-25 15:23:09 UTC (rev 11024) +++ trunk/bindings/tcl/tclAPI.c 2010-05-27 09:51:11 UTC (rev 11025) @@ -3404,7 +3404,7 @@ int argc, const char *argv[] ) { if ( argc == 1 - || argv[1] == "NULL" ) + || strcmp( argv[1], "NULL" ) == 0 ) { // The user has requested to clear the transform setting. plstransform( NULL, NULL ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-05-02 17:52:38
|
Revision: 12325 http://sourceforge.net/p/plplot/code/12325 Author: airwin Date: 2013-05-02 17:52:35 +0000 (Thu, 02 May 2013) Log Message: ----------- Style previous change. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2013-05-02 17:51:13 UTC (rev 12324) +++ trunk/bindings/tcl/tclAPI.c 2013-05-02 17:52:35 UTC (rev 12325) @@ -2597,7 +2597,7 @@ PLINT sh_cmap = 1; PLFLT sh_wid = 2.; - PLINT min_col = 1, max_col = 0; + PLINT min_col = 1, max_col = 0; PLFLT min_wid = 0., max_wid = 0.; PLINT rect = 1; const char *pltrname = "pltr0"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arj...@us...> - 2013-07-15 06:44:15
|
Revision: 12421 http://sourceforge.net/p/plplot/code/12421 Author: arjenmarkus Date: 2013-07-15 06:44:11 +0000 (Mon, 15 Jul 2013) Log Message: ----------- First shot at implementing a Tcl binding for plcolorbar. Given that example 16 does not look like the C example yet, there may still be some tweaking left. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2013-07-12 19:22:25 UTC (rev 12420) +++ trunk/bindings/tcl/tclAPI.c 2013-07-15 06:44:11 UTC (rev 12421) @@ -50,6 +50,7 @@ // PLplot/Tcl API handlers. Prototypes must come before Cmds struct static int loopbackCmd( ClientData, Tcl_Interp *, int, const char ** ); +static int plcolorbarCmd( ClientData, Tcl_Interp *, int, const char ** ); static int plcontCmd( ClientData, Tcl_Interp *, int, const char ** ); static int pllegendCmd( ClientData, Tcl_Interp *, int, const char ** ); static int plmeshCmd( ClientData, Tcl_Interp *, int, const char ** ); @@ -100,6 +101,7 @@ static CmdInfo Cmds[] = { { "loopback", loopbackCmd }, #include "tclgen_s.h" + { "plcolorbar", plcolorbarCmd }, { "plcont", plcontCmd }, { "pllegend", pllegendCmd }, { "plmap", plmapCmd }, @@ -4246,3 +4248,156 @@ return TCL_OK; } + +//-------------------------------------------------------------------------- +// plcolorbarCmd +// +// Processes plcolorbar Tcl command. +//-------------------------------------------------------------------------- + +static int +plcolorbarCmd( ClientData PL_UNUSED( clientData ), Tcl_Interp *interp, + int argc, const char *argv[] ) +{ + PLFLT colorbar_width, colorbar_height; + PLINT opt, position; + PLFLT x, y, x_length, y_length; + PLINT bg_color, bb_color, bb_style; + PLFLT low_cap_color, high_cap_color; + PLINT cont_color; + PLFLT cont_width; + PLINT n_label_opts; + PLINT n_labels; + PLINT *label_opts; + char **labels; + PLINT n_axis_opts; + PLINT n_ticks; + PLINT n_sub_ticks; + PLINT n_axes; + char **axis_opts; + PLFLT *ticks; + PLINT *sub_ticks; + Tcl_Obj *list_vectors; + int n_vectors; + PLINT *vector_sizes; + PLFLT **vector_values; + int retcode; + int i; + int length; + Tcl_Obj *vector; + tclMatrix *vectorPtr; + + double value; + + Tcl_Obj *data[2]; + + if ( argc != 20 ) + { + Tcl_AppendResult( interp, "bogus syntax for plcolorbar, see doc.", + (char *) NULL ); + return TCL_ERROR; + } + + // The first two arguments, the resulting width and height are returned via Tcl_SetObjResult() + sscanf( argv[1], "%d", &opt ); + sscanf( argv[2], "%d", &position ); + sscanf( argv[3], "%lg", &value ); x = (PLFLT) value; + sscanf( argv[4], "%lg", &value ); y = (PLFLT) value; + sscanf( argv[5], "%lg", &value ); x_length = (PLFLT) value; + sscanf( argv[6], "%lg", &value ); y_length = (PLFLT) value; + sscanf( argv[7], "%d", &bg_color ); + sscanf( argv[8], "%d", &bb_color ); + sscanf( argv[9], "%d", &bb_style ); + sscanf( argv[10], "%lg", &value ); low_cap_color = (PLFLT) value; + sscanf( argv[11], "%lg", &value ); high_cap_color = (PLFLT) value; + sscanf( argv[12], "%d", &cont_color ); + sscanf( argv[13], "%lg", &value ); cont_width = (PLFLT) value; + label_opts = argv_to_ints( interp, argv[14], &n_label_opts ); + labels = argv_to_chars( interp, argv[15], &n_labels ); + axis_opts = argv_to_chars( interp, argv[16], &n_axis_opts ); + ticks = argv_to_doubles( interp, argv[17], &n_ticks ); + sub_ticks = argv_to_ints( interp, argv[18], &n_sub_ticks ); + list_vectors = Tcl_NewStringObj( argv[19], ( -1 ) ); + + // Check consistency + if ( n_label_opts != n_labels ) + { + Tcl_AppendResult( interp, "number of label options must equal number of labels.", + (char *) NULL ); + return TCL_ERROR; + } + if ( n_axis_opts != n_ticks || n_axis_opts != n_sub_ticks ) + { + Tcl_AppendResult( interp, "number of axis, tick and subtick options must be equal.", + (char *) NULL ); + return TCL_ERROR; + } + n_axes = n_axis_opts; + + retcode = Tcl_ListObjLength( interp, list_vectors, &n_vectors ); + if ( retcode != TCL_OK || n_vectors == 0 ) + { + Tcl_AppendResult( interp, "malformed list of vectors or no vector at all.", + (char *) NULL ); + return TCL_ERROR; + } + else + { + vector_sizes = (int *) malloc( sizeof( int ) * (size_t) n_vectors ); + vector_values = (PLFLT **) malloc( sizeof( PLFLT * ) * (size_t) n_vectors ); + for ( i = 0; i < n_vectors; i++ ) + { + Tcl_ListObjIndex( interp, list_vectors, i, &vector ); + vectorPtr = Tcl_GetMatrixPtr( interp, Tcl_GetStringFromObj( vector, &length ) ); + if ( vectorPtr == NULL || vectorPtr->dim != 1 ) + { + Tcl_AppendResult( interp, "element in list of vectors is not a vector.", + (char *) NULL ); + return TCL_ERROR; + } + vector_sizes[i] = vectorPtr->n[0]; + vector_values[i] = vectorPtr->fdata; + } + } + + c_plcolorbar( &colorbar_width, &colorbar_height, + opt, position, x, y, + x_length, y_length, + bg_color, bb_color, bb_style, + low_cap_color, high_cap_color, + cont_color, cont_width, + n_labels, label_opts, (const char * const *)labels, + n_axes, (const char * const *)axis_opts, + ticks, sub_ticks, + vector_sizes, (const PLFLT * const *)vector_values ); + + if ( label_opts != NULL ) + free( label_opts ); + if ( labels != NULL ) + { + free( labels[0] ) ; + free( labels ) ; + } + if ( axis_opts != NULL ) + { + free( axis_opts[0] ) ; + free( axis_opts ) ; + } + if ( ticks != NULL ) + free( ticks ) ; + if ( sub_ticks != NULL ) + free( sub_ticks ) ; + if ( vector_values != NULL ) + { + free( vector_sizes ) ; + free( vector_values ) ; + } + + Tcl_DecrRefCount( list_vectors ); + + data[0] = Tcl_NewDoubleObj( colorbar_width ); + data[1] = Tcl_NewDoubleObj( colorbar_height ); + Tcl_SetObjResult( interp, Tcl_NewListObj( 2, data ) ); + + return TCL_OK; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-08-09 16:48:35
|
Revision: 12476 http://sourceforge.net/p/plplot/code/12476 Author: airwin Date: 2013-08-09 16:48:32 +0000 (Fri, 09 Aug 2013) Log Message: ----------- Style. This is actually a fairly intrusive change but running the test_diff_psc target shows Tcl continues to give the same results as previous. Tested by Alan W. Irwin <ai...@us...>. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2013-08-09 16:21:45 UTC (rev 12475) +++ trunk/bindings/tcl/tclAPI.c 2013-08-09 16:48:32 UTC (rev 12476) @@ -4257,39 +4257,39 @@ static int plcolorbarCmd( ClientData PL_UNUSED( clientData ), Tcl_Interp *interp, - int argc, const char *argv[] ) + int argc, const char *argv[] ) { - PLFLT colorbar_width, colorbar_height; - PLINT opt, position; - PLFLT x, y, x_length, y_length; - PLINT bg_color, bb_color, bb_style; - PLFLT low_cap_color, high_cap_color; - PLINT cont_color; - PLFLT cont_width; - PLINT n_label_opts; - PLINT n_labels; - PLINT *label_opts; - char **labels; - PLINT n_axis_opts; - PLINT n_ticks; - PLINT n_sub_ticks; - PLINT n_axes; - char **axis_opts; - PLFLT *ticks; - PLINT *sub_ticks; - Tcl_Obj *list_vectors; - int n_vectors; - PLINT *vector_sizes; - PLFLT **vector_values; - int retcode; - int i; - int length; - Tcl_Obj *vector; + PLFLT colorbar_width, colorbar_height; + PLINT opt, position; + PLFLT x, y, x_length, y_length; + PLINT bg_color, bb_color, bb_style; + PLFLT low_cap_color, high_cap_color; + PLINT cont_color; + PLFLT cont_width; + PLINT n_label_opts; + PLINT n_labels; + PLINT *label_opts; + char **labels; + PLINT n_axis_opts; + PLINT n_ticks; + PLINT n_sub_ticks; + PLINT n_axes; + char **axis_opts; + PLFLT *ticks; + PLINT *sub_ticks; + Tcl_Obj *list_vectors; + int n_vectors; + PLINT *vector_sizes; + PLFLT **vector_values; + int retcode; + int i; + int length; + Tcl_Obj *vector; tclMatrix *vectorPtr; - double value; + double value; - Tcl_Obj *data[2]; + Tcl_Obj *data[2]; if ( argc != 20 ) { @@ -4311,7 +4311,7 @@ sscanf( argv[10], "%lg", &value ); low_cap_color = (PLFLT) value; sscanf( argv[11], "%lg", &value ); high_cap_color = (PLFLT) value; sscanf( argv[12], "%d", &cont_color ); - sscanf( argv[13], "%lg", &value ); cont_width = (PLFLT) value; + sscanf( argv[13], "%lg", &value ); cont_width = (PLFLT) value; label_opts = argv_to_ints( interp, argv[14], &n_label_opts ); labels = argv_to_chars( interp, argv[15], &n_labels ); axis_opts = argv_to_chars( interp, argv[16], &n_axis_opts ); @@ -4343,8 +4343,8 @@ } else { - vector_sizes = (int *) malloc( sizeof( int ) * (size_t) n_vectors ); - vector_values = (PLFLT **) malloc( sizeof( PLFLT * ) * (size_t) n_vectors ); + vector_sizes = (int *) malloc( sizeof ( int ) * (size_t) n_vectors ); + vector_values = (PLFLT **) malloc( sizeof ( PLFLT * ) * (size_t) n_vectors ); for ( i = 0; i < n_vectors; i++ ) { Tcl_ListObjIndex( interp, list_vectors, i, &vector ); @@ -4361,36 +4361,36 @@ } c_plcolorbar( &colorbar_width, &colorbar_height, - opt, position, x, y, - x_length, y_length, - bg_color, bb_color, bb_style, - low_cap_color, high_cap_color, - cont_color, cont_width, - n_labels, label_opts, (const char * const *)labels, - n_axes, (const char * const *)axis_opts, - ticks, sub_ticks, - vector_sizes, (const PLFLT * const *)vector_values ); + opt, position, x, y, + x_length, y_length, + bg_color, bb_color, bb_style, + low_cap_color, high_cap_color, + cont_color, cont_width, + n_labels, label_opts, (const char * const *) labels, + n_axes, (const char * const *) axis_opts, + ticks, sub_ticks, + vector_sizes, (const PLFLT * const *) vector_values ); if ( label_opts != NULL ) free( label_opts ); if ( labels != NULL ) { - free( labels[0] ) ; - free( labels ) ; + free( labels[0] ); + free( labels ); } if ( axis_opts != NULL ) { - free( axis_opts[0] ) ; - free( axis_opts ) ; + free( axis_opts[0] ); + free( axis_opts ); } if ( ticks != NULL ) - free( ticks ) ; + free( ticks ); if ( sub_ticks != NULL ) - free( sub_ticks ) ; + free( sub_ticks ); if ( vector_values != NULL ) { - free( vector_sizes ) ; - free( vector_values ) ; + free( vector_sizes ); + free( vector_values ); } Tcl_DecrRefCount( list_vectors ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-11-12 23:55:08
|
Revision: 12686 http://sourceforge.net/p/plplot/code/12686 Author: airwin Date: 2013-11-12 23:55:03 +0000 (Tue, 12 Nov 2013) Log Message: ----------- Style previous commit. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2013-11-12 22:26:49 UTC (rev 12685) +++ trunk/bindings/tcl/tclAPI.c 2013-11-12 23:55:03 UTC (rev 12686) @@ -444,36 +444,36 @@ Tcl_SetVar( interp, "plversion", PLPLOT_VERSION, TCL_GLOBAL_ONLY ); if ( strcmp( PLPLOT_ITCL_VERSION, "4.0.0" ) >= 0 ) - Tcl_SetVar( interp, "pl_itcl_package_name", "Itcl 4", TCL_GLOBAL_ONLY ); + Tcl_SetVar( interp, "pl_itcl_package_name", "Itcl 4", TCL_GLOBAL_ONLY ); else if ( strcmp( PLPLOT_ITCL_VERSION, "3.0.0" ) >= 0 ) - Tcl_SetVar( interp, "pl_itcl_package_name", "Itcl 3", TCL_GLOBAL_ONLY ); + Tcl_SetVar( interp, "pl_itcl_package_name", "Itcl 3", TCL_GLOBAL_ONLY ); else - // Mark invalid package name in such a way as to cause an error - // when, for example, itcl has been disabled by PLplot, yet one - // of the PLplot Tcl scripts attempts to load Itcl. - Tcl_SetVar( interp, "pl_itcl_package_name", "Itcl(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY ); - + // Mark invalid package name in such a way as to cause an error + // when, for example, itcl has been disabled by PLplot, yet one + // of the PLplot Tcl scripts attempts to load Itcl. + Tcl_SetVar( interp, "pl_itcl_package_name", "Itcl(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY ); + if ( strcmp( PLPLOT_ITK_VERSION, "4.0.0" ) >= 0 ) - Tcl_SetVar( interp, "pl_itk_package_name", "Itk 4", TCL_GLOBAL_ONLY ); + Tcl_SetVar( interp, "pl_itk_package_name", "Itk 4", TCL_GLOBAL_ONLY ); else if ( strcmp( PLPLOT_ITK_VERSION, "3.0.0" ) >= 0 ) - Tcl_SetVar( interp, "pl_itk_package_name", "Itk 3", TCL_GLOBAL_ONLY ); + Tcl_SetVar( interp, "pl_itk_package_name", "Itk 3", TCL_GLOBAL_ONLY ); else - // Mark invalid package name in such a way as to cause an error - // when, for example, itk has been disabled by PLplot, yet one - // of the PLplot Tcl scripts attempts to load Itk. - Tcl_SetVar( interp, "pl_itk_package_name", "Itk(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY ); - + // Mark invalid package name in such a way as to cause an error + // when, for example, itk has been disabled by PLplot, yet one + // of the PLplot Tcl scripts attempts to load Itk. + Tcl_SetVar( interp, "pl_itk_package_name", "Itk(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY ); + if ( strcmp( PLPLOT_IWIDGETS_VERSION, "4.1.0" ) >= 0 ) - Tcl_SetVar( interp, "pl_iwidgets_package_name", "Iwidgets 4", TCL_GLOBAL_ONLY ); + Tcl_SetVar( interp, "pl_iwidgets_package_name", "Iwidgets 4", TCL_GLOBAL_ONLY ); else if ( strcmp( PLPLOT_IWIDGETS_VERSION, "4.0.0" ) >= 0 ) - Tcl_SetVar( interp, "pl_iwidgets_package_name", "-exact Iwidgets " PLPLOT_IWIDGETS_VERSION, TCL_GLOBAL_ONLY ); + Tcl_SetVar( interp, "pl_iwidgets_package_name", "-exact Iwidgets " PLPLOT_IWIDGETS_VERSION, TCL_GLOBAL_ONLY ); else - // Mark invalid package name in such a way as to cause an error - // when, for example, itk has been disabled by PLplot, yet one - // of the PLplot Tcl scripts attempts to load Iwidgets. - Tcl_SetVar( interp, "pl_iwidgets_package_name", "Iwidgets(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY ); - - + // Mark invalid package name in such a way as to cause an error + // when, for example, itk has been disabled by PLplot, yet one + // of the PLplot Tcl scripts attempts to load Iwidgets. + Tcl_SetVar( interp, "pl_iwidgets_package_name", "Iwidgets(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY ); + + // Begin search for init script // Each search begins with a test of libDir, so rearrangement is easy. // If search is successful, both libDir (C) and pllibrary (tcl) are set This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ai...@us...> - 2013-12-13 05:28:07
|
Revision: 12861 http://sourceforge.net/p/plplot/code/12861 Author: airwin Date: 2013-12-13 05:28:03 +0000 (Fri, 13 Dec 2013) Log Message: ----------- More useful debug printout of TCL_DIR. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2013-12-12 22:09:07 UTC (rev 12860) +++ trunk/bindings/tcl/tclAPI.c 2013-12-13 05:28:03 UTC (rev 12861) @@ -695,6 +695,7 @@ int pls_auto_path( Tcl_Interp *interp ) { + int debug = plsc->debug; char *buf, *ptr = NULL, *dn; int return_code = TCL_OK; #ifdef DEBUG @@ -706,6 +707,8 @@ // Add TCL_DIR #ifdef TCL_DIR + if( debug ) + fprintf( stderr, "adding %s to auto_path\n", TCL_DIR ); Tcl_SetVar( interp, "dir", TCL_DIR, TCL_GLOBAL_ONLY ); if ( tcl_cmd( interp, "set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR ) { @@ -713,7 +716,6 @@ goto finish; } #ifdef DEBUG - fprintf( stderr, "adding %s to auto_path\n", TCL_DIR ); path = Tcl_GetVar( interp, "auto_path", 0 ); fprintf( stderr, "auto_path is %s\n", path ); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |