From: <and...@us...> - 2013-12-03 13:03:05
|
Revision: 12805 http://sourceforge.net/p/plplot/code/12805 Author: andrewross Date: 2013-12-03 13:02:59 +0000 (Tue, 03 Dec 2013) Log Message: ----------- Update tcl bindings to plsvect will accept NULL arguments. Modified Paths: -------------- trunk/bindings/tcl/plapi.tpl trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/plapi.tpl =================================================================== --- trunk/bindings/tcl/plapi.tpl 2013-12-03 11:49:15 UTC (rev 12804) +++ trunk/bindings/tcl/plapi.tpl 2013-12-03 13:02:59 UTC (rev 12805) @@ -983,14 +983,6 @@ mark PLINT * space PLINT * -# Set the vector arrow style - -pltclcmd plsvect void -arrowx PLFLT * -arrowy PLFLT * -npts PLINT -fill PLINT - # Sets the edges of the viewport to the specified absolute coordinates. pltclcmd plsvpa void Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2013-12-03 11:49:15 UTC (rev 12804) +++ trunk/bindings/tcl/tclAPI.c 2013-12-03 13:02:59 UTC (rev 12805) @@ -64,6 +64,7 @@ static int plmapCmd( ClientData, Tcl_Interp *, int, const char ** ); static int plmeridiansCmd( ClientData, Tcl_Interp *, int, const char ** ); static int plstransformCmd( ClientData, Tcl_Interp *, int, const char ** ); +static int plsvectCmd( 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 ** ); @@ -115,6 +116,7 @@ { "plsetopt", plsetoptCmd }, { "plshade", plshadeCmd }, { "plshades", plshadesCmd }, + { "plsvect", plsvectCmd }, { "plvect", plvectCmd }, { "plrandd", plranddCmd }, { "plgriddata", plgriddataCmd }, @@ -1228,6 +1230,69 @@ } //-------------------------------------------------------------------------- +// plsvect +// +// Implement Tcl-side setting of arrow style. +//-------------------------------------------------------------------------- + +static int +plsvectCmd( ClientData PL_UNUSED( clientData ), Tcl_Interp *interp, + int argc, const char *argv[] ) +{ + tclMatrix *matx, *maty; + PLINT npts; + PLBOOL fill; + + if ( argc == 1 + || (strcmp( argv[1], "NULL" ) == 0 ) && ( strcmp( argv[2], "NULL" ) == 0 ) ) + { + // The user has requested to clear the transform setting. + plsvect( NULL, NULL, 0, 0 ); + return TCL_OK; + } + else if (argc != 4) + { + Tcl_AppendResult( interp, "wrong # args: see documentation for ", + argv[0], (char *) NULL ); + return TCL_ERROR; + } + + matx = Tcl_GetMatrixPtr( interp, argv[1] ); + if ( matx == NULL ) + return TCL_ERROR; + + if ( matx->dim != 1 ) + { + Tcl_SetResult( interp, "plsvect: Must use 1-d data.", TCL_STATIC ); + return TCL_ERROR; + } + npts = matx->n[0]; + + maty = Tcl_GetMatrixPtr( interp, argv[2] ); + if ( maty == NULL ) + return TCL_ERROR; + + if ( maty->dim != 1 ) + { + Tcl_SetResult( interp, "plsvect: Must use 1-d data.", TCL_STATIC ); + return TCL_ERROR; + } + + if ( maty->n[0] != npts ) + { + Tcl_SetResult( interp, "plsvect: Arrays must be of equal length", TCL_STATIC ); + return TCL_ERROR; + } + + fill = (PLBOOL) atoi(argv[3]); + + plsvect( matx->fdata, maty->fdata, npts, fill ); + + return TCL_OK; +} + + +//-------------------------------------------------------------------------- // plvect implementation (based on plcont above) //-------------------------------------------------------------------------- static int This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |