From: <arj...@us...> - 2008-08-24 10:04:05
|
Revision: 8707 http://plplot.svn.sourceforge.net/plplot/?rev=8707&view=rev Author: arjenmarkus Date: 2008-08-24 10:04:14 +0000 (Sun, 24 Aug 2008) Log Message: ----------- Added error message to Pltcl_Init to indicate "plplot.tcl"was not found Corrected implementation of plrandd - command did not return a value Modified Paths: -------------- trunk/bindings/tcl/plapi.tpl trunk/bindings/tcl/tclAPI.c Modified: trunk/bindings/tcl/plapi.tpl =================================================================== --- trunk/bindings/tcl/plapi.tpl 2008-08-23 19:38:14 UTC (rev 8706) +++ trunk/bindings/tcl/plapi.tpl 2008-08-24 10:04:14 UTC (rev 8707) @@ -563,9 +563,10 @@ # Random number generator based on Mersenne Twister. # Obtain real random number in range [0,1]. +# +#pltclcmd plrandd PLFLT +# (AM: does not work, no value return!) -pltclcmd plrandd PLFLT - # Replays contents of plot buffer to current device/file. pltclcmd plreplot void @@ -978,10 +979,10 @@ st PLINT& ############################################################################### -# The rest are kept in as reminders to how Tcl API might be improved +# The rest are kept in as reminders to how Tcl API might be improved # Draws a contour plot from data in f(nx,ny). Is just a front-end to -# plfcont, with a particular choice for f2eval and f2eval_data. +# plfcont, with a particular choice for f2eval and f2eval_data. # void # c_plcont(PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, @@ -991,7 +992,7 @@ # Draws a contour plot using the function evaluator f2eval and data stored # by way of the f2eval_data pointer. This allows arbitrary organizations -# of 2d array data to be used. +# of 2d array data to be used. # void # plfcont(PLFLT (*f2eval) (PLINT, PLINT, PLPointer), @@ -1009,14 +1010,14 @@ # Plot the latitudes and longitudes on the background. -# void -# plmeridians(void (*mapform)(PLINT, PLFLT *, PLFLT *), +# void +# plmeridians(void (*mapform)(PLINT, PLFLT *, PLFLT *), # PLFLT dlong, PLFLT dlat, # PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat); # Shade region. -# void +# void # c_plshade(PLFLT **a, PLINT nx, PLINT ny, const char **defined, # PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, # PLFLT shade_min, PLFLT shade_max, @@ -1027,7 +1028,7 @@ # void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), # PLPointer pltr_data); -# void +# void # plshade1(PLFLT *a, PLINT nx, PLINT ny, const char *defined, # PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, # PLFLT shade_min, PLFLT shade_max, @@ -1038,12 +1039,12 @@ # void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), # PLPointer pltr_data); -# void +# void # plfshade(PLFLT (*f2eval) (PLINT, PLINT, PLPointer), # PLPointer f2eval_data, # PLFLT (*c2eval) (PLINT, PLINT, PLPointer), # PLPointer c2eval_data, -# PLINT nx, PLINT ny, +# PLINT nx, PLINT ny, # PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, # PLFLT shade_min, PLFLT shade_max, # PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, @@ -1128,7 +1129,7 @@ # Return full pathname for given file if executable -# int +# int # plFindName(char *p); # Looks for the specified executable file according to usual search path. @@ -1137,7 +1138,7 @@ # plFindCommand(char *fn); # Gets search name for file by concatenating the dir, subdir, and file -# name, allocating memory as needed. +# name, allocating memory as needed. # void # plGetName(char *dir, char *subdir, char *filename, char **filespec); @@ -1147,7 +1148,7 @@ # int # plGetCursor(PLGraphicsIn *gin); -# Translates relative device coordinates to world coordinates. +# Translates relative device coordinates to world coordinates. # int # plTranslateCursor(PLGraphicsIn *gin); Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2008-08-23 19:38:14 UTC (rev 8706) +++ trunk/bindings/tcl/tclAPI.c 2008-08-24 10:04:14 UTC (rev 8707) @@ -62,6 +62,7 @@ static int plmapCmd (ClientData, Tcl_Interp *, int, const char **); 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 **); /* * The following structure defines all of the commands in the PLplot/Tcl @@ -100,6 +101,7 @@ {"plshade", plshadeCmd}, {"plshades", plshadesCmd}, {"plvect", plvectCmd}, + {"plrandd", plranddCmd}, {NULL, NULL} }; @@ -516,6 +518,10 @@ register CmdInfo *cmdInfoPtr; /* This must be before any other Tcl related calls */ if (PlbasicInit(interp) != TCL_OK) { + Tcl_AppendResult(interp, "Could not find plplot.tcl - please set \ +environment variable PL_LIBRARY to the directory containing that file", + (char *) NULL); + return TCL_ERROR; } @@ -2215,6 +2221,26 @@ } /*--------------------------------------------------------------------------*\ + * plranddCmd + * + * Return a random number +\*--------------------------------------------------------------------------*/ + +static int +plranddCmd(ClientData clientData, Tcl_Interp *interp, + int argc, const char **argv) +{ + if (argc != 1) { + Tcl_AppendResult(interp, "wrong # args: ", + argv[0], " takes no arguments", (char *) NULL); + return TCL_ERROR; + } else { + Tcl_SetObjResult(interp, Tcl_NewDoubleObj(plrandd())); + return TCL_OK; + } +} + +/*--------------------------------------------------------------------------*\ * plsetoptCmd * * Processes plsetopt Tcl command. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |