38 #ifdef PL_HAVE_UNISTD_H    43 #define getcwd    _getcwd    53 #undef PLPLOTTCLTK_NON_REDACTED_API    56 #define CHECK_Tcl_GetMatrixPtr( result, interp, matName ) \    57     result = Tcl_GetMatrixPtr( interp, matName );         \    58     if ( result == NULL ) return TCL_ERROR;    62 static int loopbackCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    63 static int plcolorbarCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    64 static int plcontCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    65 static int pllegendCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    66 static int plmeshCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    67 static int plmeshcCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    68 static int plot3dCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    69 static int plot3dcCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    70 static int plsurf3dCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    71 static int plsurf3dlCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    72 static int plsetoptCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    73 static int plshadeCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    74 static int plshadesCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    75 static int plmapCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    76 static int plmapfillCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    77 static int plmaplineCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    78 static int plmapstringCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    79 static int plmaptexCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    80 static int plmeridiansCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    81 static int plstransformCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    82 static int plsvectCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    83 static int plvectCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    84 static int plranddCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    85 static int plgriddataCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    86 static int plimageCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    87 static int plimagefrCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    88 static int plstripcCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
    89 static int plslabelfuncCmd( ClientData, Tcl_Interp *, 
int, 
const char ** );
   101     int ( *
proc )( 
void *, 
struct Tcl_Interp *, int, 
const char ** ); 
   112     int ( *
proc )( 
void *, 
struct Tcl_Interp *, int, 
const char ** );
   163 #define PL_LIBRARY    ""   168 #if ( !defined ( MAC_TCL ) && !defined ( _WIN32 ) )   174 #define PLPLOT_EXTENDED_SEARCH   193     static int       inited = 0;
   194     static const char** namelist;
   195     int i, j, ncmds = 
sizeof ( 
Cmds ) / 
sizeof ( 
CmdInfo );
   199         namelist = (
const char **) malloc( (
size_t) ncmds * 
sizeof ( 
char * ) );
   201         for ( i = 0; i < ncmds; i++ )
   202             namelist[i] = Cmds[i].
name;
   206         for ( i = 0; i < ncmds - 1; i++ )
   207             for ( j = i + 1; j < ncmds - 1; j++ )
   209                 if ( strcmp( namelist[i], namelist[j] ) > 0 )
   211                     const char *t = namelist[i];
   212                     namelist[i] = namelist[j];
   220     for ( i = 0; i < ncmds; i++ )
   221         Tcl_AppendResult( interp, 
" ", namelist[i], (
char *) NULL );
   245     Tcl_InitHashTable( &
cmdTable, TCL_STRING_KEYS );
   249     for ( cmdInfoPtr = Cmds; cmdInfoPtr->
name != NULL; cmdInfoPtr++ )
   254         hPtr = Tcl_CreateHashEntry( &
cmdTable, cmdInfoPtr->
name, &
new );
   262             Tcl_SetHashValue( hPtr, cmdPtr );
   291     register Tcl_HashEntry *hPtr;
   308         Tcl_AppendResult( interp, cmdlist, (
char *) NULL );
   315     hPtr = Tcl_FindHashEntry( &
cmdTable, argv[0] );
   318         Tcl_AppendResult( interp, 
"bad option \"", argv[0],
   319             "\" to \"cmd\": must be one of ",
   320             cmdlist, (
char *) NULL );
   327         result = ( *cmdPtr->
proc )( cmdPtr->
clientData, interp, argc, argv );
   328         if ( result == TCL_OK )
   333                 Tcl_AppendResult( interp, 
errmsg, (
char *) NULL );
   359     register Tcl_HashEntry *hPtr;
   363     if ( argc == 0 || ( strcmp( argv[0], 
"cmd" ) != 0 ) )
   365         Tcl_AppendResult( interp, 
"bad option \"", argv[0],
   366             "\" to \"loopback\": must be ",
   367             "\"cmd ?options?\" ", (
char *) NULL );
   390     hPtr = Tcl_FindHashEntry( &
cmdTable, argv[0] );
   393         Tcl_AppendResult( interp, 
"bad option \"", argv[0],
   394             "\" to \"loopback cmd\": must be one of ",
   402         result = ( *cmdPtr->
proc )( cmdPtr->
clientData, interp, argc, argv );
   420     int         debug        = plsc->debug;
   421     const char  *libDir      = NULL;
   422     static char initScript[] =
   423         "tcl_findLibrary plplot " PLPLOT_VERSION " \"\" plplot.tcl PL_LIBRARY pllibrary";
   424 #ifdef PLPLOT_EXTENDED_SEARCH   425     static char initScriptExtended[] =
   426         "tcl_findLibrary plplot " PLPLOT_VERSION "/tcl \"\" plplot.tcl PL_LIBRARY pllibrary";
   436     Tcl_InitStubs( interp, 
"8.1", 0 );
   443             fprintf( stderr, 
"error in matrix init\n" );
   454 #ifdef USE_MATRIX_STUBS   455     if ( Matrix_InitStubs( interp, 
"0.1", 0 ) == NULL )
   458             fprintf( stderr, 
"error in matrix stubs init\n" );
   462     Tcl_PkgRequire( interp, 
"Matrix", 
"0.1", 0 );
   466     Tcl_SetVar( interp, 
"plversion", 
PLPLOT_VERSION, TCL_GLOBAL_ONLY );
   469         Tcl_SetVar( interp, 
"pl_itcl_package_name", 
"Itcl 4", TCL_GLOBAL_ONLY );
   471         Tcl_SetVar( interp, 
"pl_itcl_package_name", 
"Itcl 3", TCL_GLOBAL_ONLY );
   476         Tcl_SetVar( interp, 
"pl_itcl_package_name", 
"Itcl(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY );
   479         Tcl_SetVar( interp, 
"pl_itk_package_name", 
"Itk 4", TCL_GLOBAL_ONLY );
   481         Tcl_SetVar( interp, 
"pl_itk_package_name", 
"Itk 3", TCL_GLOBAL_ONLY );
   486         Tcl_SetVar( interp, 
"pl_itk_package_name", 
"Itk(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY );
   489         Tcl_SetVar( interp, 
"pl_iwidgets_package_name", 
"Iwidgets 4", TCL_GLOBAL_ONLY );
   496         Tcl_SetVar( interp, 
"pl_iwidgets_package_name", 
"Iwidgets(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY );
   507             fprintf( stderr, 
"trying BUILD_DIR\n" );
   509         Tcl_SetVar( interp, 
"pllibrary", libDir, TCL_GLOBAL_ONLY );
   510         if ( Tcl_Eval( interp, initScript ) != TCL_OK )
   513             Tcl_UnsetVar( interp, 
"pllibrary", TCL_GLOBAL_ONLY );
   514             Tcl_ResetResult( interp );
   519     if ( libDir == NULL )
   522             fprintf( stderr, 
"trying init script\n" );
   523         if ( Tcl_Eval( interp, initScript ) != TCL_OK )
   526             Tcl_UnsetVar( interp, 
"pllibrary", TCL_GLOBAL_ONLY );
   528             Tcl_ResetResult( interp );
   531             libDir = Tcl_GetVar( interp, 
"pllibrary", TCL_GLOBAL_ONLY );
   536     if ( libDir == NULL )
   539             fprintf( stderr, 
"trying TCL_DIR\n" );
   541         Tcl_SetVar( interp, 
"pllibrary", libDir, TCL_GLOBAL_ONLY );
   542         if ( Tcl_Eval( interp, initScript ) != TCL_OK )
   545             Tcl_UnsetVar( interp, 
"pllibrary", TCL_GLOBAL_ONLY );
   546             Tcl_ResetResult( interp );
   551 #ifdef PLPLOT_EXTENDED_SEARCH   553     if ( libDir == NULL )
   556             fprintf( stderr, 
"trying extended init script\n" );
   557         if ( Tcl_Eval( interp, initScriptExtended ) != TCL_OK )
   560             Tcl_UnsetVar( interp, 
"pllibrary", TCL_GLOBAL_ONLY );
   562             Tcl_ResetResult( interp );
   565             libDir = Tcl_GetVar( interp, 
"pllibrary", TCL_GLOBAL_ONLY );
   569     if ( libDir == NULL )
   573             fprintf( stderr, 
"trying curdir\n" );
   574         if ( Tcl_Access( 
"plplot.tcl", 0 ) != 0 )
   577                 fprintf( stderr, 
"couldn't find plplot.tcl in curdir\n" );
   582         libDir = Tcl_GetCwd( interp, &ds );
   583         if ( libDir == NULL )
   586                 fprintf( stderr, 
"couldn't get curdir\n" );
   590         Tcl_DStringFree( &ds );
   591         Tcl_SetVar( interp, 
"pllibrary", libDir, TCL_GLOBAL_ONLY );
   593         if ( Tcl_EvalFile( interp, 
"plplot.tcl" ) != TCL_OK )
   596                 fprintf( stderr, 
"error evalling plplot.tcl\n" );
   602     if ( libDir == NULL )
   605             fprintf( stderr, 
"libdir NULL at end of search\n" );
   615     Tcl_CreateCommand( interp, 
"wait_until", (Tcl_CmdProc *) 
plWait_Until,
   616         (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
   639         Tcl_AppendResult( interp, 
"Could not find plplot.tcl - please set \   640 environment variable PL_LIBRARY to the directory containing that file",
   652     for ( cmdInfoPtr = Cmds; cmdInfoPtr->
name != NULL; cmdInfoPtr++ )
   654         Tcl_CreateCommand( interp, cmdInfoPtr->
name, cmdInfoPtr->
proc,
   655             (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
   689         if ( Tcl_ExprBoolean( interp, argv[1], &result ) )
   691             fprintf( stderr, 
"wait_until command \"%s\" failed:\n\t %s\n",
   692                 argv[1], Tcl_GetStringResult( interp ) );
   718     int  debug = plsc->debug;
   719     char *
buf, *ptr = NULL, *dn;
   725     buf = (
char *) malloc( 256 * 
sizeof ( 
char ) );
   731         fprintf( stderr, 
"adding %s to auto_path\n", 
TCL_DIR );
   732     Tcl_SetVar( interp, 
"dir", 
TCL_DIR, TCL_GLOBAL_ONLY );
   733     if ( 
tcl_cmd( interp, 
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
   735         return_code = TCL_ERROR;
   739     path = Tcl_GetVar( interp, 
"auto_path", 0 );
   740     fprintf( stderr, 
"auto_path is %s\n", path );
   746     if ( ( dn = getenv( 
"HOME" ) ) != NULL )
   749         Tcl_SetVar( interp, 
"dir", ptr, 0 );
   750         if ( 
tcl_cmd( interp, 
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
   752             return_code = TCL_ERROR;
   756         fprintf( stderr, 
"adding %s to auto_path\n", ptr );
   757         path = Tcl_GetVar( interp, 
"auto_path", 0 );
   758         fprintf( stderr, 
"auto_path is %s\n", path );
   764 #if defined ( PL_TCL_ENV )   765     if ( ( dn = getenv( PL_TCL_ENV ) ) != NULL )
   768         Tcl_SetVar( interp, 
"dir", ptr, 0 );
   769         if ( 
tcl_cmd( interp, 
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
   771             return_code = TCL_ERROR;
   775         fprintf( stderr, 
"adding %s to auto_path\n", ptr );
   776         path = Tcl_GetVar( interp, 
"auto_path", 0 );
   777         fprintf( stderr, 
"auto_path is %s\n", path );
   784 #if defined ( PL_HOME_ENV )   785     if ( ( dn = getenv( PL_HOME_ENV ) ) != NULL )
   788         Tcl_SetVar( interp, 
"dir", ptr, 0 );
   789         if ( 
tcl_cmd( interp, 
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
   791             return_code = TCL_ERROR;
   795         fprintf( stderr, 
"adding %s to auto_path\n", ptr );
   796         path = Tcl_GetVar( interp, 
"auto_path", 0 );
   797         fprintf( stderr, 
"auto_path is %s\n", path );
   800 #endif  // PL_HOME_ENV   804     if ( getcwd( buf, 256 ) == 0 )
   806         Tcl_SetResult( interp, 
"Problems with getcwd in pls_auto_path", TCL_STATIC );
   808             return_code = TCL_ERROR;
   812     Tcl_SetVar( interp, 
"dir", buf, 0 );
   813     if ( 
tcl_cmd( interp, 
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
   815         return_code = TCL_ERROR;
   821         Tcl_SetVar( interp, 
"dir", 
BUILD_DIR "/bindings/tk", TCL_GLOBAL_ONLY );
   822         if ( 
tcl_cmd( interp, 
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
   824             return_code = TCL_ERROR;
   830     fprintf( stderr, 
"adding %s to auto_path\n", buf );
   831     path = Tcl_GetVar( interp, 
"auto_path", 0 );
   832     fprintf( stderr, 
"auto_path is %s\n", path );
   848 tcl_cmd( Tcl_Interp *interp, 
const char *cmd )
   852     result = Tcl_VarEval( interp, cmd, (
char **) NULL );
   853     if ( result != TCL_OK )
   855         fprintf( stderr, 
"TCL command \"%s\" failed:\n\t %s\n",
   856             cmd, Tcl_GetStringResult( interp ) );
   926     PLINT      nx, ny, kx = 0, lx = 0, ky = 0, ly = 0, nclev;
   927     const char *pltrname = 
"pltr0";
   928     tclMatrix  *mattrx   = NULL, *mattry = NULL;
   929     PLFLT      **z, **zused, **zwrapped;
   931     int        arg3_is_kx = 1, i, j;
   941         Tcl_AppendResult( interp, 
"wrong # args: see documentation for ",
   942             argv[0], (
char *) NULL );
   948     if ( matf->
dim != 2 )
   950         Tcl_SetResult( interp, 
"Must use 2-d data.", TCL_STATIC );
   957         tclmateval_modx = nx;
   958         tclmateval_mody = ny;
   963         for ( i = 0; i < nx; i++ )
   965             for ( j = 0; j < ny; j++ )
   975     for ( i = 0; i < (int) strlen( argv[2] ) && arg3_is_kx; i++ )
   976         if ( !isdigit( argv[2][i] ) )
   984             Tcl_SetResult( interp, 
"plcont, bogus syntax", TCL_STATIC );
   989         kx = atoi( argv[3] );
   990         lx = atoi( argv[4] );
   991         ky = atoi( argv[5] );
   992         ly = atoi( argv[6] );
   995         argc -= 6, argv += 6;
   999         argc -= 2, argv += 2;
  1006         Tcl_SetResult( interp, 
"plcont, bogus syntax", TCL_STATIC );
  1011     nclev = matclev->
n[0];
  1013     if ( matclev->
dim != 1 )
  1015         Tcl_SetResult( interp, 
"clev must be 1-d matrix.", TCL_STATIC );
  1030         argc -= 3, argv += 3;
  1036         wrap = atoi( argv[0] );
  1048         Tcl_SetResult( interp, 
"plcont, bogus syntax, too many args.", TCL_STATIC );
  1054     if ( !strcmp( pltrname, 
"pltr0" ) )
  1062             Tcl_SetResult( interp, 
"Must use pltr2 if want wrapping.", TCL_STATIC );
  1066     else if ( !strcmp( pltrname, 
"pltr1" ) )
  1071         cgrid1.
yg = mattry->fdata;
  1078             Tcl_SetResult( interp, 
"Must use pltr2 if want wrapping.", TCL_STATIC );
  1082         if ( mattrx->
dim != 1 || mattry->dim != 1 )
  1084             Tcl_SetResult( interp, 
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
  1088         pltr_data = &cgrid1;
  1090     else if ( !strcmp( pltrname, 
"pltr2" ) )
  1103             for ( i = 0; i < nx; i++ )
  1104                 for ( j = 0; j < ny; j++ )
  1105                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  1108             for ( i = 0; i < nx; i++ )
  1109                 for ( j = 0; j < ny; j++ )
  1110                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  1112         else if ( wrap == 1 )
  1122             for ( i = 0; i < nx; i++ )
  1123                 for ( j = 0; j < ny; j++ )
  1124                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  1127             for ( i = 0; i < nx; i++ )
  1129                 for ( j = 0; j < ny; j++ )
  1131                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  1132                     zwrapped[i][j]  = z[i][j];
  1136             for ( j = 0; j < ny; j++ )
  1138                 cgrid2.
xg[nx][j] = cgrid2.
xg[0][j];
  1139                 cgrid2.
yg[nx][j] = cgrid2.
yg[0][j];
  1140                 zwrapped[nx][j]  = zwrapped[0][j];
  1149         else if ( wrap == 2 )
  1159             for ( i = 0; i < nx; i++ )
  1160                 for ( j = 0; j < ny; j++ )
  1161                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  1164             for ( i = 0; i < nx; i++ )
  1166                 for ( j = 0; j < ny; j++ )
  1168                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  1169                     zwrapped[i][j]  = z[i][j];
  1173             for ( i = 0; i < nx; i++ )
  1175                 cgrid2.
xg[i][ny] = cgrid2.
xg[i][0];
  1176                 cgrid2.
yg[i][ny] = cgrid2.
yg[i][0];
  1177                 zwrapped[i][ny]  = zwrapped[i][0];
  1188             Tcl_SetResult( interp, 
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
  1193         pltr_data = &cgrid2;
  1197         Tcl_AppendResult( interp,
  1198             "Unrecognized coordinate transformation spec:",
  1199             pltrname, 
", must be pltr0 pltr1 or pltr2.",
  1217     plcont( (
const PLFLT * 
const *) zused, nx, ny,
  1219         matclev->
fdata, nclev,
  1230     if ( pltr == 
pltr1 )
  1235     else if ( pltr == 
pltr2 )
  1261          || ( strcmp( argv[1], 
"NULL" ) == 0 ) && ( strcmp( argv[2], 
"NULL" ) == 0 ) )
  1267     else if ( argc != 4 )
  1269         Tcl_AppendResult( interp, 
"wrong # args: see documentation for ",
  1270             argv[0], (
char *) NULL );
  1276     if ( matx->
dim != 1 )
  1278         Tcl_SetResult( interp, 
"plsvect: Must use 1-d data.", TCL_STATIC );
  1285     if ( maty->
dim != 1 )
  1287         Tcl_SetResult( interp, 
"plsvect: Must use 1-d data.", TCL_STATIC );
  1291     if ( maty->
n[0] != npts )
  1293         Tcl_SetResult( interp, 
"plsvect: Arrays must be of equal length", TCL_STATIC );
  1297     fill = (
PLBOOL) atoi( argv[3] );
  1314     const char *pltrname = 
"pltr0";
  1315     tclMatrix  *mattrx   = NULL, *mattry = NULL;
  1316     PLFLT      **u, **v, **uused, **vused, **uwrapped, **vwrapped;
  1329         Tcl_AppendResult( interp, 
"wrong # args: see documentation for ",
  1330             argv[0], (
char *) NULL );
  1336     if ( matu->
dim != 2 )
  1338         Tcl_SetResult( interp, 
"Must use 2-d data.", TCL_STATIC );
  1345         tclmateval_modx = nx;
  1346         tclmateval_mody = ny;
  1351         for ( i = 0; i < nx; i++ )
  1353             for ( j = 0; j < ny; j++ )
  1362     if ( matv->
dim != 2 )
  1364         Tcl_SetResult( interp, 
"Must use 2-d data.", TCL_STATIC );
  1371         tclmateval_modx = nx;
  1372         tclmateval_mody = ny;
  1377         for ( i = 0; i < nx; i++ )
  1379             for ( j = 0; j < ny; j++ )
  1386     argc -= 3, argv += 3;
  1392         Tcl_SetResult( interp, 
"plvect, bogus syntax", TCL_STATIC );
  1396     scaling = atof( argv[0] );
  1408         argc -= 3, argv += 3;
  1414         wrap = atoi( argv[0] );
  1426         Tcl_SetResult( interp, 
"plvect, bogus syntax, too many args.", TCL_STATIC );
  1432     if ( !strcmp( pltrname, 
"pltr0" ) )
  1441             Tcl_SetResult( interp, 
"Must use pltr2 if want wrapping.", TCL_STATIC );
  1445     else if ( !strcmp( pltrname, 
"pltr1" ) )
  1450         cgrid1.
yg = mattry->fdata;
  1458             Tcl_SetResult( interp, 
"Must use pltr2 if want wrapping.", TCL_STATIC );
  1462         if ( mattrx->
dim != 1 || mattry->dim != 1 )
  1464             Tcl_SetResult( interp, 
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
  1468         pltr_data = &cgrid1;
  1470     else if ( !strcmp( pltrname, 
"pltr2" ) )
  1484             for ( i = 0; i < nx; i++ )
  1485                 for ( j = 0; j < ny; j++ )
  1486                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  1488             for ( i = 0; i < nx; i++ )
  1490                 for ( j = 0; j < ny; j++ )
  1492                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  1496         else if ( wrap == 1 )
  1509             for ( i = 0; i < nx; i++ )
  1510                 for ( j = 0; j < ny; j++ )
  1511                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  1514             for ( i = 0; i < nx; i++ )
  1516                 for ( j = 0; j < ny; j++ )
  1518                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  1519                     uwrapped[i][j]  = u[i][j];
  1520                     vwrapped[i][j]  = v[i][j];
  1524             for ( j = 0; j < ny; j++ )
  1526                 cgrid2.
xg[nx][j] = cgrid2.
xg[0][j];
  1527                 cgrid2.
yg[nx][j] = cgrid2.
yg[0][j];
  1528                 uwrapped[nx][j]  = uwrapped[0][j];
  1529                 vwrapped[nx][j]  = vwrapped[0][j];
  1538         else if ( wrap == 2 )
  1550             for ( i = 0; i < nx; i++ )
  1551                 for ( j = 0; j < ny; j++ )
  1552                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  1555             for ( i = 0; i < nx; i++ )
  1557                 for ( j = 0; j < ny; j++ )
  1559                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  1560                     uwrapped[i][j]  = u[i][j];
  1561                     vwrapped[i][j]  = v[i][j];
  1565             for ( i = 0; i < nx; i++ )
  1567                 cgrid2.
xg[i][ny] = cgrid2.
xg[i][0];
  1568                 cgrid2.
yg[i][ny] = cgrid2.
yg[i][0];
  1569                 uwrapped[i][ny]  = uwrapped[i][0];
  1570                 vwrapped[i][ny]  = vwrapped[i][0];
  1582             Tcl_SetResult( interp, 
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
  1587         pltr_data = &cgrid2;
  1591         Tcl_AppendResult( interp,
  1592             "Unrecognized coordinate transformation spec:",
  1593             pltrname, 
", must be pltr0 pltr1 or pltr2.",
  1601     plvect( (
const PLFLT * 
const *) uused, (
const PLFLT * 
const *) vused, nx, ny,
  1602         scaling, pltr, pltr_data );
  1612     if ( pltr == 
pltr1 )
  1617     else if ( pltr == 
pltr2 )
  1653 #ifdef PLPLOTTCLTK_NON_REDACTED_API  1656         nx  = atoi( argv[4] );
  1657         ny  = atoi( argv[5] );
  1658         opt = atoi( argv[6] );
  1669             Tcl_SetResult( interp, 
"x y and z must all be float", TCL_STATIC );
  1673         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  1674              maty->
dim != 1 || maty->
n[0] != ny ||
  1675              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
  1677             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  1684         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  1685         for ( i = 0; i < nx; i++ )
  1686             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  1688     else if ( argc == 5 )
  1693         opt = atoi( argv[4] );
  1704             Tcl_SetResult( interp, 
"x y and z must all be float", TCL_STATIC );
  1708         nx = matx->
n[0]; ny = maty->
n[0];
  1710         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  1711              maty->
dim != 1 || maty->
n[0] != ny ||
  1712              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
  1714             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  1721         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  1722         for ( i = 0; i < nx; i++ )
  1723             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  1725     else if ( argc == 3 )
  1727         Tcl_SetResult( interp, 
"unimplemented", TCL_STATIC );
  1732         Tcl_AppendResult( interp, 
"wrong # args: should be \"plmesh ",
  1733             "x y z nx ny opt\", or a valid contraction ",
  1734             "thereof.", (
char *) NULL );
  1738     plmesh( x, y, (
const PLFLT * 
const *) z, nx, ny, opt );
  1744     else if ( argc == 5 )
  1779     PLINT     nx, ny, opt, nlev = 10;
  1783     tclMatrix *matx, *maty, *matz, *matPtr, *matlev;
  1786 #ifdef PLPLOTTCLTK_NON_REDACTED_API  1789         nlev = atoi( argv[8] );
  1790         nx   = atoi( argv[4] );
  1791         ny   = atoi( argv[5] );
  1792         opt  = atoi( argv[6] );
  1806             Tcl_SetResult( interp, 
"x y z and clevel must all be float", TCL_STATIC );
  1810         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  1811              maty->
dim != 1 || maty->
n[0] != ny ||
  1812              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  1813              matlev->
dim != 1 || matlev->
n[0] != nlev )
  1815             Tcl_SetResult( interp, 
"popo Inconsistent dimensions", TCL_STATIC );
  1821         clev = matlev->
fdata;
  1823         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  1824         for ( i = 0; i < nx; i++ )
  1825             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  1828     else if ( argc == 8 )
  1830         nx  = atoi( argv[4] );
  1831         ny  = atoi( argv[5] );
  1832         opt = atoi( argv[6] );
  1845             Tcl_SetResult( interp, 
"x y z and clevel must all be float", TCL_STATIC );
  1849         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  1850              maty->
dim != 1 || maty->
n[0] != ny ||
  1851              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  1852              matlev->
dim != 1 || matlev->
n[0] != nlev )
  1854             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  1860         clev = matlev->
fdata;
  1861         nlev = matlev->
n[0];
  1863         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  1864         for ( i = 0; i < nx; i++ )
  1865             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  1868     else if ( argc == 7 )
  1870         nx   = atoi( argv[4] );
  1871         ny   = atoi( argv[5] );
  1872         opt  = atoi( argv[6] );
  1884             Tcl_SetResult( interp, 
"x y and z must all be float", TCL_STATIC );
  1888         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  1889              maty->
dim != 1 || maty->
n[0] != ny ||
  1890              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
  1892             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  1899         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  1900         for ( i = 0; i < nx; i++ )
  1901             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  1904     else if ( argc == 6 )
  1909         opt = atoi( argv[4] );
  1919         nlev = matlev->
n[0];
  1926             Tcl_SetResult( interp, 
"x y z and clevel must all be float", TCL_STATIC );
  1930         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  1931              maty->
dim != 1 || maty->
n[0] != ny ||
  1932              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  1933              matlev->
dim != 1 || matlev->
n[0] != nlev )
  1935             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  1941         clev = matlev->
fdata;
  1943         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  1944         for ( i = 0; i < nx; i++ )
  1945             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  1948     else if ( argc == 5 )
  1950         opt  = atoi( argv[4] );
  1962             Tcl_SetResult( interp, 
"x y and z must all be float", TCL_STATIC );
  1966         nx = matx->
n[0]; ny = maty->
n[0];
  1968         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  1969              maty->
dim != 1 || maty->
n[0] != ny ||
  1970              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
  1972             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  1979         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  1980         for ( i = 0; i < nx; i++ )
  1981             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  1983     else if ( argc == 3 )
  1985         Tcl_SetResult( interp, 
"unimplemented", TCL_STATIC );
  1990         Tcl_AppendResult( interp, 
"wrong # args: should be \"plmeshc ",
  1991             "x y z nx ny opt clevel nlevel\", or a valid contraction ",
  1992             "thereof.", (
char *) NULL );
  1996     plmeshc( x, y, (
const PLFLT * 
const *) z, nx, ny, opt, clev, nlev );
  2002     else if ( argc == 5 || argc == 6 )
  2033     PLINT     nx, ny, opt, side;
  2038 #ifdef PLPLOTTCLTK_NON_REDACTED_API  2041         nx   = atoi( argv[4] );
  2042         ny   = atoi( argv[5] );
  2043         opt  = atoi( argv[6] );
  2044         side = atoi( argv[7] );
  2055             Tcl_SetResult( interp, 
"x y and z must all be float", TCL_STATIC );
  2059         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2060              maty->
dim != 1 || maty->
n[0] != ny ||
  2061              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
  2063             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2070         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2071         for ( i = 0; i < nx; i++ )
  2072             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2074     else if ( argc == 6 )
  2079         opt  = atoi( argv[4] );
  2080         side = atoi( argv[5] );
  2091             Tcl_SetResult( interp, 
"x y and z must all be float", TCL_STATIC );
  2095         nx = matx->
n[0]; ny = maty->
n[0];
  2097         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2098              maty->
dim != 1 || maty->
n[0] != ny ||
  2099              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
  2101             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2108         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2109         for ( i = 0; i < nx; i++ )
  2110             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2112     else if ( argc == 4 )
  2114         Tcl_SetResult( interp, 
"unimplemented", TCL_STATIC );
  2119         Tcl_AppendResult( interp, 
"wrong # args: should be \"plot3d ",
  2120             "x y z nx ny opt side\", or a valid contraction ",
  2121             "thereof.", (
char *) NULL );
  2125     plot3d( x, y, (
const PLFLT * 
const *) z, nx, ny, opt, side );
  2131     else if ( argc == 6 )
  2166     PLINT     nx, ny, opt, nlev = 10;
  2170     tclMatrix *matx, *maty, *matz, *matPtr, *matlev;
  2173 #ifdef PLPLOTTCLTK_NON_REDACTED_API  2176         nlev = atoi( argv[8] );
  2177         nx   = atoi( argv[4] );
  2178         ny   = atoi( argv[5] );
  2179         opt  = atoi( argv[6] );
  2193             Tcl_SetResult( interp, 
"x y z and clevel must all be float", TCL_STATIC );
  2197         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2198              maty->
dim != 1 || maty->
n[0] != ny ||
  2199              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  2200              matlev->
dim != 1 || matlev->
n[0] != nlev )
  2202             Tcl_SetResult( interp, 
"popo Inconsistent dimensions", TCL_STATIC );
  2208         clev = matlev->
fdata;
  2210         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2211         for ( i = 0; i < nx; i++ )
  2212             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2215     else if ( argc == 8 )
  2217         nx  = atoi( argv[4] );
  2218         ny  = atoi( argv[5] );
  2219         opt = atoi( argv[6] );
  2232             Tcl_SetResult( interp, 
"x y z and clevel must all be float", TCL_STATIC );
  2236         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2237              maty->
dim != 1 || maty->
n[0] != ny ||
  2238              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  2239              matlev->
dim != 1 || matlev->
n[0] != nlev )
  2241             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2247         clev = matlev->
fdata;
  2248         nlev = matlev->
n[0];
  2250         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2251         for ( i = 0; i < nx; i++ )
  2252             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2255     else if ( argc == 7 )
  2257         nx   = atoi( argv[4] );
  2258         ny   = atoi( argv[5] );
  2259         opt  = atoi( argv[6] );
  2271             Tcl_SetResult( interp, 
"x y and z must all be float", TCL_STATIC );
  2275         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2276              maty->
dim != 1 || maty->
n[0] != ny ||
  2277              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
  2279             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2286         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2287         for ( i = 0; i < nx; i++ )
  2288             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2291     else if ( argc == 6 )
  2296         opt = atoi( argv[4] );
  2306         nlev = matlev->
n[0];
  2313             Tcl_SetResult( interp, 
"x y z and clevel must all be float", TCL_STATIC );
  2317         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2318              maty->
dim != 1 || maty->
n[0] != ny ||
  2319              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  2320              matlev->
dim != 1 || matlev->
n[0] != nlev )
  2322             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2328         clev = matlev->
fdata;
  2330         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2331         for ( i = 0; i < nx; i++ )
  2332             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2335     else if ( argc == 5 )
  2337         opt  = atoi( argv[4] );
  2349             Tcl_SetResult( interp, 
"x y and z must all be float", TCL_STATIC );
  2353         nx = matx->
n[0]; ny = maty->
n[0];
  2355         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2356              maty->
dim != 1 || maty->
n[0] != ny ||
  2357              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
  2359             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2366         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2367         for ( i = 0; i < nx; i++ )
  2368             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2370     else if ( argc == 3 )
  2372         Tcl_SetResult( interp, 
"unimplemented", TCL_STATIC );
  2377         Tcl_AppendResult( interp, 
"wrong # args: should be \"plot3dc ",
  2378             "x y z nx ny opt clevel nlevel\", or a valid contraction ",
  2379             "thereof.", (
char *) NULL );
  2383     plot3dc( x, y, (
const PLFLT * 
const *) z, nx, ny, opt, clev, nlev );
  2389     else if ( argc == 5 || argc == 6 )
  2424     PLINT     nx, ny, opt, nlev = 10;
  2428     tclMatrix *matx, *maty, *matz, *matPtr, *matlev;
  2431 #ifdef PLPLOTTCLTK_NON_REDACTED_API  2434         nlev = atoi( argv[8] );
  2435         nx   = atoi( argv[4] );
  2436         ny   = atoi( argv[5] );
  2437         opt  = atoi( argv[6] );
  2451             Tcl_SetResult( interp, 
"x y z and clevel must all be float", TCL_STATIC );
  2455         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2456              maty->
dim != 1 || maty->
n[0] != ny ||
  2457              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  2458              matlev->
dim != 1 || matlev->
n[0] != nlev )
  2460             Tcl_SetResult( interp, 
"popo Inconsistent dimensions", TCL_STATIC );
  2466         clev = matlev->
fdata;
  2468         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2469         for ( i = 0; i < nx; i++ )
  2470             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2473     else if ( argc == 8 )
  2475         nx  = atoi( argv[4] );
  2476         ny  = atoi( argv[5] );
  2477         opt = atoi( argv[6] );
  2490             Tcl_SetResult( interp, 
"x y z and clevel must all be float", TCL_STATIC );
  2494         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2495              maty->
dim != 1 || maty->
n[0] != ny ||
  2496              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  2497              matlev->
dim != 1 || matlev->
n[0] != nlev )
  2499             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2505         clev = matlev->
fdata;
  2506         nlev = matlev->
n[0];
  2508         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2509         for ( i = 0; i < nx; i++ )
  2510             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2513     else if ( argc == 7 )
  2515         nx   = atoi( argv[4] );
  2516         ny   = atoi( argv[5] );
  2517         opt  = atoi( argv[6] );
  2529             Tcl_SetResult( interp, 
"x y and z must all be float", TCL_STATIC );
  2533         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2534              maty->
dim != 1 || maty->
n[0] != ny ||
  2535              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
  2537             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2544         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2545         for ( i = 0; i < nx; i++ )
  2546             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2549     else if ( argc == 6 )
  2554         opt = atoi( argv[4] );
  2564         nlev = matlev->
n[0];
  2571             Tcl_SetResult( interp, 
"x y z and clevel must all be float", TCL_STATIC );
  2575         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2576              maty->
dim != 1 || maty->
n[0] != ny ||
  2577              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  2578              matlev->
dim != 1 || matlev->
n[0] != nlev )
  2580             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2586         clev = matlev->
fdata;
  2588         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2589         for ( i = 0; i < nx; i++ )
  2590             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2593     else if ( argc == 5 )
  2595         opt  = atoi( argv[4] );
  2607             Tcl_SetResult( interp, 
"x y and z must all be float", TCL_STATIC );
  2611         nx = matx->
n[0]; ny = maty->
n[0];
  2613         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2614              maty->
dim != 1 || maty->
n[0] != ny ||
  2615              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
  2617             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2624         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2625         for ( i = 0; i < nx; i++ )
  2626             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2628     else if ( argc == 3 )
  2630         Tcl_SetResult( interp, 
"unimplemented", TCL_STATIC );
  2635         Tcl_AppendResult( interp, 
"wrong # args: should be \"plsurf3d ",
  2636             "x y z nx ny opt clevel nlevel\", or a valid contraction ",
  2637             "thereof.", (
char *) NULL );
  2641     plsurf3d( x, y, (
const PLFLT * 
const *) z, nx, ny, opt, clev, nlev );
  2647     else if ( argc == 5 )
  2682     PLINT     nx, ny, opt, nlev = 10;
  2685     PLINT     indexxmin, indexxmax;
  2687     tclMatrix *matx, *maty, *matz, *matPtr, *matlev;
  2689     PLINT     *idxymin, *idxymax;
  2693 #ifdef PLPLOTTCLTK_NON_REDACTED_API  2696         nlev = atoi( argv[8] );
  2697         nx   = atoi( argv[4] );
  2698         ny   = atoi( argv[5] );
  2699         opt  = atoi( argv[6] );
  2701         indexxmin = atoi( argv[9] );
  2702         indexxmax = atoi( argv[10] );
  2708             Tcl_SetResult( interp, 
"indexymin and indexymax must be integer matrices", TCL_STATIC );
  2724             Tcl_SetResult( interp, 
"x y z and clevel must all be float matrices", TCL_STATIC );
  2728         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2729              maty->
dim != 1 || maty->
n[0] != ny ||
  2730              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  2731              matlev->
dim != 1 || matlev->
n[0] != nlev ||
  2732              indexymin->
dim != 1 || indexymin->
n[0] != indexxmax ||
  2733              indexymax->
dim != 1 || indexymax->
n[0] != indexxmax )
  2735             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2741         clev = matlev->
fdata;
  2743         idxymin = indexymin->
idata;
  2744         idxymax = indexymax->
idata;
  2746         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2747         for ( i = 0; i < nx; i++ )
  2748             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2751     else if ( argc == 12 )
  2753         nx  = atoi( argv[4] );
  2754         ny  = atoi( argv[5] );
  2755         opt = atoi( argv[6] );
  2757         indexxmin = atoi( argv[8] );
  2758         indexxmax = atoi( argv[9] );
  2764             Tcl_SetResult( interp, 
"indexymin and indexymax must be integer matrices", TCL_STATIC );
  2779             Tcl_SetResult( interp, 
"x y z and clevel must all be float matrices", TCL_STATIC );
  2783         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2784              maty->
dim != 1 || maty->
n[0] != ny ||
  2785              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  2786              matlev->
dim != 1 || matlev->
n[0] != nlev ||
  2787              indexymin->
dim != 1 || indexymin->
n[0] != indexxmax ||
  2788              indexymax->
dim != 1 || indexymax->
n[0] != indexxmax )
  2790             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2796         clev = matlev->
fdata;
  2797         nlev = matlev->
n[0];
  2799         idxymin = indexymin->
idata;
  2800         idxymax = indexymax->
idata;
  2802         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2803         for ( i = 0; i < nx; i++ )
  2804             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2807     else if ( argc == 11 )
  2809         nx   = atoi( argv[4] );
  2810         ny   = atoi( argv[5] );
  2811         opt  = atoi( argv[6] );
  2814         indexxmin = atoi( argv[7] );
  2815         indexxmax = atoi( argv[8] );
  2821             Tcl_SetResult( interp, 
"indexymin and indexymax must be integer matrices", TCL_STATIC );
  2834             Tcl_SetResult( interp, 
"x y and z must all be float matrices", TCL_STATIC );
  2838         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2839              maty->
dim != 1 || maty->
n[0] != ny ||
  2840              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  2841              indexymin->
dim != 1 || indexymin->
n[0] != indexxmax ||
  2842              indexymax->
dim != 1 || indexymax->
n[0] != indexxmax )
  2844             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2851         idxymin = indexymin->
idata;
  2852         idxymax = indexymax->
idata;
  2854         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2855         for ( i = 0; i < nx; i++ )
  2856             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2859     else if ( argc == 9 )
  2864         indexxmin = atoi( argv[6] );
  2870             Tcl_SetResult( interp, 
"indexymin and indexymax must be integer matrices", TCL_STATIC );
  2873         indexxmax = indexymin->
n[0];
  2883         opt = atoi( argv[4] );
  2890             Tcl_SetResult( interp, 
"x y z and clevel must all be float matrices", TCL_STATIC );
  2894         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2895              maty->
dim != 1 || maty->
n[0] != ny ||
  2896              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  2897              matlev->
dim != 1 || matlev->
n[0] != nlev ||
  2898              indexymin->
dim != 1 || indexymin->
n[0] != indexxmax ||
  2899              indexymax->
dim != 1 || indexymax->
n[0] != indexxmax )
  2901             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2907         clev = matlev->
fdata;
  2908         nlev = matlev->
n[0];
  2910         idxymin = indexymin->
idata;
  2911         idxymax = indexymax->
idata;
  2913         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2914         for ( i = 0; i < nx; i++ )
  2915             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2918     else if ( argc == 8 )
  2920         opt  = atoi( argv[4] );
  2923         indexxmin = atoi( argv[5] );
  2929             Tcl_SetResult( interp, 
"indexymin and indexymax must be integer matrices", TCL_STATIC );
  2932         indexxmax = indexymin->
n[0];
  2943             Tcl_SetResult( interp, 
"x y and z must all be float", TCL_STATIC );
  2947         nx = matx->
n[0]; ny = maty->
n[0];
  2949         if ( matx->
dim != 1 || matx->
n[0] != nx ||
  2950              maty->
dim != 1 || maty->
n[0] != ny ||
  2951              matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
  2952              indexymin->
dim != 1 || indexymin->
n[0] != indexxmax ||
  2953              indexymax->
dim != 1 || indexymax->
n[0] != indexxmax )
  2955             Tcl_SetResult( interp, 
"Inconsistent dimensions", TCL_STATIC );
  2962         idxymin = indexymin->
idata;
  2963         idxymax = indexymax->
idata;
  2965         z = (
PLFLT **) malloc( (
size_t) nx * 
sizeof ( 
PLFLT * ) );
  2966         for ( i = 0; i < nx; i++ )
  2967             z[i] = &matz->
fdata[ 
I2D( i, 0 ) ];
  2969     else if ( argc == 2 )
  2971         Tcl_SetResult( interp, 
"unimplemented", TCL_STATIC );
  2976         Tcl_AppendResult( interp, 
"wrong # args: should be \"plsurf3dl ",
  2977             "x y z nx ny opt clevel nlevel indexxmin indexxmax indexymin ",
  2978             "indexymax\", or a valid contraction thereof.", (
char *) NULL );
  2982     plsurf3dl( x, y, (
const PLFLT * 
const *) z, nx, ny, opt, clev, nlev, indexxmin, indexxmax, idxymin, idxymax );
  2988     else if ( argc == 9 || argc == 10 )
  3012         Tcl_AppendResult( interp, 
"wrong # args: ",
  3013             argv[0], 
" takes no arguments", (
char *) NULL );
  3018         Tcl_SetObjResult( interp, Tcl_NewDoubleObj( (
double) 
plrandd() ) );
  3033     if ( argc < 2 || argc > 3 )
  3035         Tcl_AppendResult( interp, 
"wrong # args: should be \"",
  3036             argv[0], 
" option ?argument?\"", (
char *) NULL );
  3075     tclMatrix  *matPtr, *matz, *mattrx = NULL, *mattry = NULL;
  3076     PLFLT      **z, **zused, **zwrapped;
  3081     PLINT      min_col   = 1, max_col = 0;
  3082     PLFLT      min_wid   = 0., max_wid = 0.;
  3084     const char *pltrname = 
"pltr0";
  3094         Tcl_AppendResult( interp, 
"bogus syntax for plshade, see doc.",
  3100     if ( matz->
dim != 2 )
  3102         Tcl_SetResult( interp, 
"Must plot a 2-d matrix.", TCL_STATIC );
  3109     tclmateval_modx = nx;
  3110     tclmateval_mody = ny;
  3115     for ( i = 0; i < nx; i++ )
  3117         for ( j = 0; j < ny; j++ )
  3123     xmin    = atof( argv[2] );
  3124     xmax    = atof( argv[3] );
  3125     ymin    = atof( argv[4] );
  3126     ymax    = atof( argv[5] );
  3127     sh_min  = atof( argv[6] );
  3128     sh_max  = atof( argv[7] );
  3129     sh_cmap = atoi( argv[8] );
  3130     sh_col  = atof( argv[9] );
  3131     sh_wid  = atof( argv[10] );
  3132     min_col = atoi( argv[11] );
  3133     min_wid = atoi( argv[12] );
  3134     max_col = atoi( argv[13] );
  3135     max_wid = atof( argv[14] );
  3136     rect    = atoi( argv[15] );
  3138     argc -= 16, argv += 16;
  3146         argc -= 3, argv += 3;
  3148     else if ( argc && !strcmp( argv[0], 
"NULL" ) )
  3151         argc    -= 1, argv += 1;
  3156         wrap = atoi( argv[0] );
  3162         Tcl_SetResult( interp, 
"plshade: bogus arg list", TCL_STATIC );
  3169     if ( !strcmp( pltrname, 
"NULL" ) )
  3177             Tcl_SetResult( interp, 
"Must use pltr2 if want wrapping.", TCL_STATIC );
  3181     else if ( !strcmp( pltrname, 
"pltr0" ) )
  3189             Tcl_SetResult( interp, 
"Must use pltr2 if want wrapping.", TCL_STATIC );
  3193     else if ( !strcmp( pltrname, 
"pltr1" ) )
  3198         cgrid1.
yg = mattry->fdata;
  3205             Tcl_SetResult( interp, 
"Must use pltr2 if want wrapping.", TCL_STATIC );
  3209         if ( mattrx->
dim != 1 || mattry->dim != 1 )
  3211             Tcl_SetResult( interp, 
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
  3215         pltr_data = &cgrid1;
  3217     else if ( !strcmp( pltrname, 
"pltr2" ) )
  3230             for ( i = 0; i < nx; i++ )
  3231                 for ( j = 0; j < ny; j++ )
  3232                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  3235             for ( i = 0; i < nx; i++ )
  3236                 for ( j = 0; j < ny; j++ )
  3237                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  3239         else if ( wrap == 1 )
  3249             for ( i = 0; i < nx; i++ )
  3250                 for ( j = 0; j < ny; j++ )
  3251                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  3254             for ( i = 0; i < nx; i++ )
  3256                 for ( j = 0; j < ny; j++ )
  3258                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  3259                     zwrapped[i][j]  = z[i][j];
  3263             for ( j = 0; j < ny; j++ )
  3265                 cgrid2.
xg[nx][j] = cgrid2.
xg[0][j];
  3266                 cgrid2.
yg[nx][j] = cgrid2.
yg[0][j];
  3267                 zwrapped[nx][j]  = zwrapped[0][j];
  3276         else if ( wrap == 2 )
  3286             for ( i = 0; i < nx; i++ )
  3287                 for ( j = 0; j < ny; j++ )
  3288                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  3291             for ( i = 0; i < nx; i++ )
  3293                 for ( j = 0; j < ny; j++ )
  3295                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  3296                     zwrapped[i][j]  = z[i][j];
  3300             for ( i = 0; i < nx; i++ )
  3302                 cgrid2.
xg[i][ny] = cgrid2.
xg[i][0];
  3303                 cgrid2.
yg[i][ny] = cgrid2.
yg[i][0];
  3304                 zwrapped[i][ny]  = zwrapped[i][0];
  3315             Tcl_SetResult( interp, 
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
  3320         pltr_data = &cgrid2;
  3324         Tcl_AppendResult( interp,
  3325             "Unrecognized coordinate transformation spec:",
  3326             pltrname, 
", must be NULL, pltr0, pltr1, or pltr2.",
  3333     plshade( (
const PLFLT * 
const *) zused, nx, ny, NULL,
  3334         xmin, xmax, ymin, ymax,
  3335         sh_min, sh_max, sh_cmap, sh_col, sh_wid,
  3336         min_col, min_wid, max_col, max_wid,
  3337         plfill, rect, pltr, pltr_data );
  3347     if ( pltr == 
pltr1 )
  3352     else if ( pltr == 
pltr2 )
  3392     tclMatrix  *matPtr, *matz, *mattrx = NULL, *mattry = NULL;
  3394     PLFLT      **z, **zused, **zwrapped;
  3395     PLFLT      xmin, xmax, ymin, ymax;
  3396     PLINT      cont_color = 0;
  3397     PLFLT      fill_width = 0., cont_width = 0.;
  3399     const char *pltrname  = 
"pltr0";
  3405     int        nx, ny, nlevel, i, j;
  3409         Tcl_AppendResult( interp, 
"bogus syntax for plshades, see doc.",
  3415     if ( matz->
dim != 2 )
  3417         Tcl_SetResult( interp, 
"Must plot a 2-d matrix.", TCL_STATIC );
  3424     tclmateval_modx = nx;
  3425     tclmateval_mody = ny;
  3430     for ( i = 0; i < nx; i++ )
  3432         for ( j = 0; j < ny; j++ )
  3438     xmin = atof( argv[2] );
  3439     xmax = atof( argv[3] );
  3440     ymin = atof( argv[4] );
  3441     ymax = atof( argv[5] );
  3444     nlevel = matclevel->
n[0];
  3445     if ( matclevel->
dim != 1 )
  3447         Tcl_SetResult( interp, 
"clevel must be 1-d matrix.", TCL_STATIC );
  3451     fill_width = atof( argv[7] );
  3452     cont_color = atoi( argv[8] );
  3453     cont_width = atof( argv[9] );
  3454     rect       = atoi( argv[10] );
  3456     argc -= 11, argv += 11;
  3464         argc -= 3, argv += 3;
  3466     else if ( argc && !strcmp( argv[0], 
"NULL" ) )
  3469         argc    -= 1, argv += 1;
  3474         wrap = atoi( argv[0] );
  3480         Tcl_SetResult( interp, 
"plshades: bogus arg list", TCL_STATIC );
  3487     if ( !strcmp( pltrname, 
"NULL" ) )
  3495             Tcl_SetResult( interp, 
"Must use pltr2 if want wrapping.", TCL_STATIC );
  3499     else if ( !strcmp( pltrname, 
"pltr0" ) )
  3507             Tcl_SetResult( interp, 
"Must use pltr2 if want wrapping.", TCL_STATIC );
  3511     else if ( !strcmp( pltrname, 
"pltr1" ) )
  3516         cgrid1.
yg = mattry->fdata;
  3523             Tcl_SetResult( interp, 
"Must use pltr2 if want wrapping.", TCL_STATIC );
  3527         if ( mattrx->
dim != 1 || mattry->dim != 1 )
  3529             Tcl_SetResult( interp, 
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
  3533         pltr_data = &cgrid1;
  3535     else if ( !strcmp( pltrname, 
"pltr2" ) )
  3548             for ( i = 0; i < nx; i++ )
  3549                 for ( j = 0; j < ny; j++ )
  3550                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  3553             for ( i = 0; i < nx; i++ )
  3554                 for ( j = 0; j < ny; j++ )
  3555                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  3557         else if ( wrap == 1 )
  3567             for ( i = 0; i < nx; i++ )
  3568                 for ( j = 0; j < ny; j++ )
  3569                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  3572             for ( i = 0; i < nx; i++ )
  3574                 for ( j = 0; j < ny; j++ )
  3576                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  3577                     zwrapped[i][j]  = z[i][j];
  3581             for ( j = 0; j < ny; j++ )
  3583                 cgrid2.
xg[nx][j] = cgrid2.
xg[0][j];
  3584                 cgrid2.
yg[nx][j] = cgrid2.
yg[0][j];
  3585                 zwrapped[nx][j]  = zwrapped[0][j];
  3594         else if ( wrap == 2 )
  3604             for ( i = 0; i < nx; i++ )
  3605                 for ( j = 0; j < ny; j++ )
  3606                     cgrid2.
xg[i][j] = mattrx->
fdata[ 
I2D( i, j ) ];
  3609             for ( i = 0; i < nx; i++ )
  3611                 for ( j = 0; j < ny; j++ )
  3613                     cgrid2.
yg[i][j] = mattry->fdata[ 
I2D( i, j ) ];
  3614                     zwrapped[i][j]  = z[i][j];
  3618             for ( i = 0; i < nx; i++ )
  3620                 cgrid2.
xg[i][ny] = cgrid2.
xg[i][0];
  3621                 cgrid2.
yg[i][ny] = cgrid2.
yg[i][0];
  3622                 zwrapped[i][ny]  = zwrapped[i][0];
  3633             Tcl_SetResult( interp, 
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
  3638         pltr_data = &cgrid2;
  3642         Tcl_AppendResult( interp,
  3643             "Unrecognized coordinate transformation spec:",
  3644             pltrname, 
", must be NULL, pltr0, pltr1, or pltr2.",
  3651     plshades( (
const PLFLT * 
const *) zused, nx, ny, NULL,
  3652         xmin, xmax, ymin, ymax,
  3653         matclevel->
fdata, nlevel, fill_width, cont_color, cont_width,
  3654         plfill, rect, pltr, pltr_data );
  3664     if ( pltr == 
pltr1 )
  3669     else if ( pltr == 
pltr2 )
  3699     cmd = (
char *) malloc( strlen( transform_name ) + 40 );
  3702     sprintf( cmd, 
"matrix %cx f %d", (
char) 1, n );
  3703     if ( Tcl_Eval( tcl_interp, cmd ) != TCL_OK )
  3705         return_code = TCL_ERROR;
  3709     sprintf( cmd, 
"matrix %cy f %d", (
char) 1, n );
  3710     if ( Tcl_Eval( tcl_interp, cmd ) != TCL_OK )
  3712         return_code = TCL_ERROR;
  3717     sprintf( cmd, 
"%cx", (
char) 1 );
  3721         return_code = TCL_ERROR;
  3726     sprintf( cmd, 
"%cy", (
char) 1 );
  3730         return_code = TCL_ERROR;
  3735     for ( i = 0; i < n; i++ )
  3737         xPtr->
fdata[i] = x[i];
  3738         yPtr->
fdata[i] = y[i];
  3742     sprintf( cmd, 
"%s %d %cx %cy", transform_name, n, (
char) 1, (
char) 1 );
  3743     return_code = Tcl_Eval( tcl_interp, cmd );
  3744     if ( return_code != TCL_OK )
  3752     for ( i = 0; i < n; i++ )
  3754         x[i] = xPtr->
fdata[i];
  3755         y[i] = yPtr->
fdata[i];
  3761     sprintf( cmd, 
"rename %cx {}; rename %cy {}", (
char) 1, (
char) 1 );
  3762     return_code = Tcl_Eval( tcl_interp, cmd );
  3781     PLFLT minlong, maxlong, minlat, maxlat;
  3785     return_code = TCL_OK;
  3789         transform_name = NULL;
  3792     else if ( argc == 7 )
  3795         transform_name = argv[1];
  3796         if ( strlen( transform_name ) == 0 )
  3806         return_code = TCL_ERROR;
  3809     if ( return_code == TCL_ERROR )
  3811         Tcl_AppendResult( interp, 
"bogus syntax for plmap, see doc.",
  3816         minlong = atof( argv[idxname + 1] );
  3817         maxlong = atof( argv[idxname + 2] );
  3818         minlat  = atof( argv[idxname + 3] );
  3819         maxlat  = atof( argv[idxname + 4] );
  3820         if ( transform && idxname == 2 )
  3822             plmap( &
mapform, argv[idxname], minlong, maxlong, minlat, maxlat );
  3827             plmap( NULL, argv[idxname], minlong, maxlong, minlat, maxlat );
  3848     int       *entries = NULL;
  3855         if ( Tcl_SplitList( interp, 
string, n, (
const char ***) &argv ) == TCL_OK )
  3857             entries = (
int *) malloc( ( *n ) * 
sizeof ( int ) );
  3858             for ( i = 0; i < *n; i++ )
  3860                 entries[i] = atoi( argv[i] );
  3862             Tcl_Free( (
char *) argv );
  3868         entries = (
int *) malloc( ( *n ) * 
sizeof ( int ) );
  3869         for ( i = 0; i < *n; i++ )
  3871             entries[i] = mati->
idata[i];
  3892     PLFLT  minlong, maxlong, minlat, maxlat;
  3899     return_code = TCL_OK;
  3909         transform_name = NULL;
  3924         transform_name = argv[1];
  3925         if ( strlen( transform_name ) == 0 )
  3931             if ( Tcl_GetDouble( interp, argv[2], &dminlong ) == TCL_OK )
  3935                 entries   = 
GetEntries( interp, argv[6], &nentries );
  3937                     return_code = TCL_ERROR;
  3944         transform_name = argv[1];
  3945         if ( strlen( transform_name ) == 0 )
  3952         entries = 
GetEntries( interp, argv[7], &nentries );
  3954             return_code = TCL_ERROR;
  3958         return_code = TCL_ERROR;
  3961     if ( return_code == TCL_ERROR )
  3963         Tcl_AppendResult( interp, 
"bogus syntax for plmapfill, see doc.",
  3968         minlong = atof( argv[idxname + 1] );
  3969         maxlong = atof( argv[idxname + 2] );
  3970         minlat  = atof( argv[idxname + 3] );
  3971         maxlat  = atof( argv[idxname + 4] );
  3972         if ( transform && idxname == 2 )
  3974             plmapfill( &
mapform, argv[idxname], minlong, maxlong, minlat, maxlat, entries, nentries );
  3979             plmapfill( NULL, argv[idxname], minlong, maxlong, minlat, maxlat, entries, nentries );
  4004     PLFLT  minlong, maxlong, minlat, maxlat;
  4011     return_code = TCL_OK;
  4021         transform_name = NULL;
  4037         transform_name = argv[1];
  4038         if ( strlen( transform_name ) == 0 )
  4044             if ( Tcl_GetDouble( interp, argv[2], &dminlong ) == TCL_OK )
  4048                 entries   = 
GetEntries( interp, argv[6], &nentries );
  4050                     return_code = TCL_ERROR;
  4057         transform_name = argv[1];
  4058         if ( strlen( transform_name ) == 0 )
  4066         entries    = 
GetEntries( interp, argv[7], &nentries );
  4069             return_code = TCL_ERROR;
  4073         return_code = TCL_ERROR;
  4076     if ( return_code == TCL_ERROR )
  4078         Tcl_AppendResult( interp, 
"bogus syntax for plmapline, see doc.",
  4083         minlong = atof( argv[idxname + 1] );
  4084         maxlong = atof( argv[idxname + 2] );
  4085         minlat  = atof( argv[idxname + 3] );
  4086         maxlat  = atof( argv[idxname + 4] );
  4087         if ( transform && idxname == 2 )
  4089             plmapline( &
mapform, argv[idxname], minlong, maxlong, minlat, maxlat, entries, nentries );
  4094             plmapline( NULL, argv[idxname], minlong, maxlong, minlat, maxlat, entries, nentries );
  4119     PLFLT      minlong, maxlong, minlat, maxlat;
  4127     return_code = TCL_OK;
  4128     if ( argc < 7 || argc > 9 )
  4130         Tcl_AppendResult( interp, 
"bogus syntax for plmapstring, see doc.",
  4143         transform_name = NULL;
  4158         transform_name = argv[1];
  4159         if ( strlen( transform_name ) == 0 )
  4165             if ( Tcl_GetDouble( interp, argv[3], &dminlong ) == TCL_OK )
  4169                 entries   = 
GetEntries( interp, argv[7], &nentries );
  4171                     return_code = TCL_ERROR;
  4178         transform_name = argv[1];
  4179         if ( strlen( transform_name ) == 0 )
  4187         entries    = 
GetEntries( interp, argv[8], &nentries );
  4189             return_code = TCL_ERROR;
  4192         return_code = TCL_ERROR;
  4195     string  = argv[idxname + 1];
  4196     minlong = atof( argv[idxname + 2] );
  4197     maxlong = atof( argv[idxname + 3] );
  4198     minlat  = atof( argv[idxname + 4] );
  4199     maxlat  = atof( argv[idxname + 5] );
  4200     if ( entries != NULL )
  4202         if ( transform && idxname == 2 )
  4204             plmapstring( &
mapform, argv[idxname], 
string, minlong, maxlong, minlat, maxlat, entries, nentries );
  4209             plmapstring( NULL, argv[idxname], 
string, minlong, maxlong, minlat, maxlat, entries, nentries );
  4233     PLFLT      minlong, maxlong, minlat, maxlat;
  4241     return_code = TCL_OK;
  4248         if ( Tcl_GetDouble( interp, argv[2], &dminlong ) == TCL_OK )
  4254             return_code = TCL_ERROR;
  4259         transform_name = argv[1];
  4260         if ( strlen( transform_name ) == 0 )
  4267         return_code = TCL_ERROR;
  4270     if ( return_code == TCL_ERROR )
  4272         Tcl_AppendResult( interp, 
"bogus syntax for plmaptex, see doc.",
  4277         dx        = atof( argv[idxname + 1] );
  4278         dy        = atof( argv[idxname + 2] );
  4279         just      = atof( argv[idxname + 3] );
  4280         text      = argv[idxname + 4];
  4281         minlong   = atof( argv[idxname + 5] );
  4282         maxlong   = atof( argv[idxname + 6] );
  4283         minlat    = atof( argv[idxname + 7] );
  4284         maxlat    = atof( argv[idxname + 8] );
  4285         plotentry = atoi( argv[idxname + 9] );
  4286         if ( transform && idxname == 2 )
  4288             plmaptex( &
mapform, argv[idxname], dx, dy, just, text, minlong, maxlong, minlat, maxlat, plotentry );
  4293             plmaptex( NULL, argv[idxname], dx, dy, just, text, minlong, maxlong, minlat, maxlat, plotentry );
  4316     PLFLT dlong, dlat, minlong, maxlong, minlat, maxlat;
  4319     return_code = TCL_OK;
  4321     if ( argc < 7 || argc > 8 )
  4323         Tcl_AppendResult( interp, 
"bogus syntax for plmeridians, see doc.",
  4331         transform_name = NULL;
  4332         dlong          = atof( argv[1] );
  4333         dlat           = atof( argv[2] );
  4334         minlong        = atof( argv[3] );
  4335         maxlong        = atof( argv[4] );
  4336         minlat         = atof( argv[5] );
  4337         maxlat         = atof( argv[6] );
  4341         dlong   = atof( argv[2] );
  4342         dlat    = atof( argv[3] );
  4343         minlong = atof( argv[4] );
  4344         maxlong = atof( argv[5] );
  4345         minlat  = atof( argv[6] );
  4346         maxlat  = atof( argv[7] );
  4350         transform_name = argv[1];
  4351         if ( strlen( transform_name ) == 0 )
  4363         plmeridians( NULL, dlong, dlat, minlong, maxlong, minlat, maxlat );
  4373 #if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 5  4374     "set result [%s ${_##_x} ${_##_y}] ; set _##_x [lindex $result 0] ; set _##_y [lindex $result 1]"  4376     "set result [%s ${_##_x} ${_##_y}] ; lassign $result _##_x _##_y"  4385     Tcl_Obj *objx, *objy;
  4390     objx = Tcl_NewDoubleObj( (
double) x );
  4391     Tcl_IncrRefCount( objx );
  4392     Tcl_SetVar2Ex( tcl_xform_interp,
  4393         "_##_x", NULL, objx, 0 );
  4394     Tcl_DecrRefCount( objx );
  4397     objy = Tcl_NewDoubleObj( (
double) y );
  4398     Tcl_IncrRefCount( objy );
  4399     Tcl_SetVar2Ex( tcl_xform_interp,
  4400         "_##_y", NULL, objy, 0 );
  4401     Tcl_DecrRefCount( objy );
  4410     code = Tcl_Eval( tcl_xform_interp, tcl_xform_code );
  4412     if ( code != TCL_OK )
  4414         printf( 
"Unable to evaluate Tcl-side coordinate transform.\n" );
  4415         printf( 
"code = %d\n", code );
  4416         printf( 
"Error result: %s\n", Tcl_GetStringResult( tcl_xform_interp ) );
  4420     objx = Tcl_GetVar2Ex( tcl_xform_interp, 
"_##_x", NULL, 0 );
  4421     objy = Tcl_GetVar2Ex( tcl_xform_interp, 
"_##_y", NULL, 0 );
  4425     if ( Tcl_GetDoubleFromObj( tcl_xform_interp, objx, &dx ) != TCL_OK ||
  4426          Tcl_GetDoubleFromObj( tcl_xform_interp, objy, &dy ) != TCL_OK )
  4428         printf( 
"Unable to extract Tcl results.\n" );
  4447          || strcmp( argv[1], 
"NULL" ) == 0 )
  4451         tcl_xform_interp = 0;
  4452         if ( tcl_xform_procname )
  4454             free( tcl_xform_procname );
  4455             tcl_xform_procname = 0;
  4462         tcl_xform_interp   = 
interp;
  4463         tcl_xform_procname = 
plstrdup( argv[1] );
  4465         len            = strlen( tcl_xform_template ) + strlen( tcl_xform_procname );
  4466         tcl_xform_code = malloc( len );
  4467         sprintf( tcl_xform_code, tcl_xform_template, tcl_xform_procname );
  4484     tclMatrix *arrx, *arry, *arrz, *xcoord, *ycoord, *zvalue;
  4485     PLINT     pts, nx, ny, alg;
  4494         Tcl_AppendResult( interp, 
"wrong # args: see documentation for ",
  4495             argv[0], (
char *) NULL );
  4505     sscanf( argv[7], 
"%d", &alg );
  4507     sscanf( argv[8], 
"%lg", &value ); optalg = (
PLFLT) value;
  4509     if ( arrx->
dim != 1 )
  4511         Tcl_AppendResult( interp, argv[0], 
": argument 1 should be a \  4512 one-dimensional matrix - ", argv[1], (
char *) NULL );
  4515     if ( arry->
dim != 1 )
  4517         Tcl_AppendResult( interp, argv[0], 
": argument 2 should be a \  4518 one-dimensional matrix - ", argv[2], (
char *) NULL );
  4521     if ( arrz->
dim != 1 )
  4523         Tcl_AppendResult( interp, argv[0], 
": argument 3 should be a \  4524 one-dimensional matrix - ", argv[3], (
char *) NULL );
  4528     if ( xcoord->
dim != 1 )
  4530         Tcl_AppendResult( interp, argv[0], 
": argument 4 should be a \  4531 one-dimensional matrix - ", argv[4], (
char *) NULL );
  4534     if ( ycoord->
dim != 1 )
  4536         Tcl_AppendResult( interp, argv[0], 
": argument 5 should be a \  4537 one-dimensional matrix - ", argv[5], (
char *) NULL );
  4540     if ( zvalue->
dim != 2 )
  4542         Tcl_AppendResult( interp, argv[0], 
": argument 6 should be a \  4543 two-dimensional matrix - ", argv[6], (
char *) NULL );
  4557         xcoord->
fdata, nx, ycoord->
fdata, ny, z, alg, optalg );
  4560     for ( i = 0; i < nx; i++ )
  4562         for ( j = 0; j < ny; j++ )
  4564             zvalue->
fdata[j + zvalue->
n[1] * i] = z[i][j];
  4584     PLFLT     xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, Dymin, Dymax;
  4591         Tcl_AppendResult( interp, 
"wrong # args: see documentation for ",
  4592             argv[0], (
char *) NULL );
  4598     if ( zvalue->
dim != 2 )
  4600         Tcl_AppendResult( interp, argv[0], 
": argument 1 should be a \  4601 two-dimensional matrix - ", argv[1], (
char *) NULL );
  4605     sscanf( argv[2], 
"%lg", &value ); xmin   = (
PLFLT) value;
  4606     sscanf( argv[3], 
"%lg", &value ); xmax   = (
PLFLT) value;
  4607     sscanf( argv[4], 
"%lg", &value ); ymin   = (
PLFLT) value;
  4608     sscanf( argv[5], 
"%lg", &value ); ymax   = (
PLFLT) value;
  4609     sscanf( argv[6], 
"%lg", &value ); zmin   = (
PLFLT) value;
  4610     sscanf( argv[7], 
"%lg", &value ); zmax   = (
PLFLT) value;
  4611     sscanf( argv[8], 
"%lg", &value ); Dxmin  = (
PLFLT) value;
  4612     sscanf( argv[9], 
"%lg", &value ); Dxmax  = (
PLFLT) value;
  4613     sscanf( argv[10], 
"%lg", &value ); Dymin = (
PLFLT) value;
  4614     sscanf( argv[11], 
"%lg", &value ); Dymax = (
PLFLT) value;
  4621     for ( i = 0; i < nx; i++ )
  4623         for ( j = 0; j < ny; j++ )
  4625             pidata[i][j] = zvalue->
fdata[j + i * ny];
  4637     c_plimage( (
const PLFLT * 
const *) pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
  4638         Dxmin, Dxmax, Dymin, Dymax );
  4663     PLFLT     xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax;
  4668     if ( argc != 12 && argc != 10 )
  4670         Tcl_AppendResult( interp, 
"wrong # args: see documentation for ",
  4671             argv[0], (
char *) NULL );
  4677     if ( zvalue->
dim != 2 )
  4679         Tcl_AppendResult( interp, argv[0], 
": argument 1 should be a \  4680 two-dimensional matrix - ", argv[1], (
char *) NULL );
  4693             Tcl_AppendResult( interp, argv[0], 
": argument 10 should be a \  4694 two-dimensional matrix - ", argv[10], (
char *) NULL );
  4700             Tcl_AppendResult( interp, argv[0], 
": argument 11 should be a \  4701 two-dimensional matrix - ", argv[11], (
char *) NULL );
  4706     sscanf( argv[2], 
"%lg", &value ); xmin     = (
PLFLT) value;
  4707     sscanf( argv[3], 
"%lg", &value ); xmax     = (
PLFLT) value;
  4708     sscanf( argv[4], 
"%lg", &value ); ymin     = (
PLFLT) value;
  4709     sscanf( argv[5], 
"%lg", &value ); ymax     = (
PLFLT) value;
  4710     sscanf( argv[6], 
"%lg", &value ); zmin     = (
PLFLT) value;
  4711     sscanf( argv[7], 
"%lg", &value ); zmax     = (
PLFLT) value;
  4712     sscanf( argv[8], 
"%lg", &value ); valuemin = (
PLFLT) value;
  4713     sscanf( argv[9], 
"%lg", &value ); valuemax = (
PLFLT) value;
  4720     for ( i = 0; i < nx; i++ )
  4722         for ( j = 0; j < ny; j++ )
  4724             pidata[i][j] = zvalue->
fdata[j + i * ny];
  4735         for ( i = 0; i <= nx; i++ )
  4737             for ( j = 0; j <= ny; j++ )
  4739                 cgrid2.
xg[i][j] = xg->
fdata[j + i * ( ny + 1 )];
  4740                 cgrid2.
yg[i][j] = yg->
fdata[j + i * ( ny + 1 )];
  4743         c_plimagefr( (
const PLFLT * 
const *) pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
  4744             valuemin, valuemax, 
pltr2, (
void *) &cgrid2 );
  4748         c_plimagefr( (
const PLFLT * 
const *) pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
  4749             valuemin, valuemax, NULL, NULL );
  4780     PLFLT      xmin, xmax, xjump, ymin, ymax, xlpos, ylpos;
  4782     PLINT      colbox, collab;
  4783     PLINT      colline[4], styline[4];
  4785     const char **legline;
  4793         Tcl_AppendResult( interp, 
"wrong # args: see documentation for ",
  4794             argv[0], (
char *) NULL );
  4801     if ( colMat->
dim != 1 || colMat->
idata == NULL )
  4803         Tcl_AppendResult( interp, argv[0], 
": argument 15 should be a \  4804 one-dimensional integer matrix - ", argv[15], (
char *) NULL );
  4808     if ( styleMat->
dim != 1 || styleMat->
idata == NULL )
  4810         Tcl_AppendResult( interp, argv[0], 
": argument 16 should be a \  4811 one-dimensional integer matrix - ", argv[16], (
char *) NULL );
  4819     sscanf( argv[4], 
"%lg", &value ); xmin    = (
PLFLT) value;
  4820     sscanf( argv[5], 
"%lg", &value ); xmax    = (
PLFLT) value;
  4821     sscanf( argv[6], 
"%lg", &value ); xjump   = (
PLFLT) value;
  4822     sscanf( argv[7], 
"%lg", &value ); ymin    = (
PLFLT) value;
  4823     sscanf( argv[8], 
"%lg", &value ); ymax    = (
PLFLT) value;
  4824     sscanf( argv[9], 
"%lg", &value ); xlpos   = (
PLFLT) value;
  4825     sscanf( argv[10], 
"%lg", &value ); ylpos  = (
PLFLT) value;
  4826     sscanf( argv[11], 
"%d", &ivalue ); y_ascl = (
PLBOOL) ivalue;
  4827     sscanf( argv[12], 
"%d", &ivalue ); acc    = (
PLBOOL) ivalue;
  4828     sscanf( argv[13], 
"%d", &ivalue ); colbox = ivalue;
  4829     sscanf( argv[14], 
"%d", &ivalue ); collab = ivalue;
  4835     for ( i = 0; i < 4; i++ )
  4837         colline[i] = colMat->
idata[i];
  4838         styline[i] = styleMat->
idata[i];
  4841     if ( Tcl_SplitList( interp, argv[17], &nlegend, &legline ) != TCL_OK )
  4847         Tcl_AppendResult( interp, argv[0], 
": argument 18 should be a \  4848 list of at least four items - ", argv[17], (
char *) NULL );
  4853         xmin, xmax, xjump, ymin, ymax,
  4857         colline, styline, legline,
  4858         labx, laby, labtop );
  4860     sprintf( idvalue, 
"%d", 
id );
  4861     Tcl_SetVar( interp, idName, idvalue, 0 );
  4863     Tcl_Free( (
char *) legline );
  4882     label_objs[1] = Tcl_NewIntObj( axis );
  4883     label_objs[2] = Tcl_NewDoubleObj( (
double) value );
  4885     Tcl_IncrRefCount( label_objs[1] );
  4886     Tcl_IncrRefCount( label_objs[2] );
  4890     if ( label_objs[3] != NULL )
  4895     return_code = Tcl_EvalObjv( tcl_interp, objc, label_objs, 0 );
  4897     if ( return_code != TCL_OK )
  4899         strncpy( 
string, 
"ERROR", (
size_t) string_length );
  4903         strncpy( 
string, Tcl_GetStringResult( tcl_interp ), (
size_t) string_length );
  4906     Tcl_DecrRefCount( label_objs[1] );
  4907     Tcl_DecrRefCount( label_objs[2] );
  4923     if ( argc < 2 || argc > 3 )
  4925         Tcl_AppendResult( interp, 
"bogus syntax for plslabelfunc, see doc.",
  4932     if ( label_objs[0] != NULL )
  4934         Tcl_DecrRefCount( label_objs[0] );
  4936     if ( label_objs[3] != NULL )
  4938         Tcl_DecrRefCount( label_objs[3] );
  4939         label_objs[3] = NULL;
  4942     if ( strlen( argv[1] ) == 0 )
  4950         label_objs[0] = Tcl_NewStringObj( argv[1], (
int) strlen( argv[1] ) );
  4951         Tcl_IncrRefCount( label_objs[0] );
  4956         label_objs[3] = Tcl_NewStringObj( argv[2], (
int) strlen( argv[2] ) ); 
  4957         Tcl_IncrRefCount( label_objs[3] );
  4961         label_objs[3] = NULL;
  4976 static int *
argv_to_ints( Tcl_Interp *interp, 
const char *list_numbers, 
int *number )
  4983     list = Tcl_NewStringObj( list_numbers, ( -1 ) );
  4985     retcode = Tcl_ListObjLength( interp, list, number );
  4986     if ( retcode != TCL_OK || ( *number ) == 0 )
  4993         array = (
int *) malloc( 
sizeof ( 
int ) * (size_t) ( *number ) );
  4994         for ( i = 0; i < ( *number ); i++ )
  4996             Tcl_ListObjIndex( interp, list, i, &elem );
  4997             Tcl_GetIntFromObj( interp, elem, &array[i] );
  5011     list = Tcl_NewStringObj( list_numbers, ( -1 ) );
  5013     retcode = Tcl_ListObjLength( interp, list, number );
  5014     if ( retcode != TCL_OK || ( *number ) == 0 )
  5021         array = (
PLFLT *) malloc( 
sizeof ( 
PLFLT ) * (size_t) ( *number ) );
  5022         for ( i = 0; i < ( *number ); i++ )
  5024             Tcl_ListObjIndex( interp, list, i, &elem );
  5025             Tcl_GetDoubleFromObj( interp, elem, &ddata );
  5026             array[i] = (
PLFLT) ddata;
  5032 static char **
argv_to_chars( Tcl_Interp *interp, 
const char *list_strings, 
int *number )
  5042     list = Tcl_NewStringObj( list_strings, ( -1 ) );
  5044     retcode = Tcl_ListObjLength( interp, list, number );
  5045     if ( retcode != TCL_OK || ( *number ) == 0 )
  5052         array    = (
char **) malloc( 
sizeof ( 
char* ) * (size_t) ( *number ) );
  5053         array[0] = (
char *) malloc( 
sizeof ( 
char ) * ( strlen( list_strings ) + 1 ) );
  5055         for ( i = 0; i < ( *number ); i++ )
  5057             Tcl_ListObjIndex( interp, list, i, &elem );
  5058             string = Tcl_GetStringFromObj( elem, &length );
  5060             array[i] = array[0] + idx;
  5061             strncpy( array[i], 
string, (
size_t) length );
  5063             array[0][idx - 1] = 
'\0';
  5073     PLFLT   legend_width, legend_height;
  5074     PLFLT   x, y, plot_width;
  5075     PLINT   opt, position;
  5076     PLINT   bg_color, bb_color, bb_style;
  5077     PLINT   nrow, ncolumn;
  5080     PLFLT   text_offset, text_scale, text_spacing, text_justification;
  5082     PLINT   *box_colors, *box_patterns;
  5084     PLINT   *line_colors, *line_styles;
  5085     PLFLT   *box_line_widths, *line_widths;
  5086     PLINT   *symbol_colors, *symbol_numbers;
  5087     PLFLT   *symbol_scales;
  5100         Tcl_AppendResult( interp, 
"bogus syntax for pllegend, see doc.",
  5105     sscanf( argv[1], 
"%d", &opt );
  5106     sscanf( argv[2], 
"%d", &position );
  5107     sscanf( argv[3], 
"%lg", &value ); x          = (
PLFLT) value;
  5108     sscanf( argv[4], 
"%lg", &value ); y          = (
PLFLT) value;
  5109     sscanf( argv[5], 
"%lg", &value ); plot_width = (
PLFLT) value;
  5110     sscanf( argv[6], 
"%d", &bg_color );
  5111     sscanf( argv[7], 
"%d", &bb_color );
  5112     sscanf( argv[8], 
"%d", &bb_style );
  5113     sscanf( argv[9], 
"%d", &nrow );
  5114     sscanf( argv[10], 
"%d", &ncolumn );
  5115     opt_array = 
argv_to_ints( interp, argv[11], &number_opts );
  5116     sscanf( argv[12], 
"%lg", &value ); text_offset        = (
PLFLT) value;
  5117     sscanf( argv[13], 
"%lg", &value ); text_scale         = (
PLFLT) value;
  5118     sscanf( argv[14], 
"%lg", &value ); text_spacing       = (
PLFLT) value;
  5119     sscanf( argv[15], 
"%lg", &value ); text_justification = (
PLFLT) value;
  5121     text_colors     = 
argv_to_ints( interp, argv[16], &dummy );
  5124     box_patterns    = 
argv_to_ints( interp, argv[19], &dummy );
  5127     line_colors     = 
argv_to_ints( interp, argv[22], &dummy );
  5128     line_styles     = 
argv_to_ints( interp, argv[23], &dummy );
  5130     symbol_colors   = 
argv_to_ints( interp, argv[25], &dummy );
  5132     symbol_numbers  = 
argv_to_ints( interp, argv[27], &dummy );
  5135     nlegend = 
MIN( number_opts, number_texts );
  5138         opt, position, x, y, plot_width,
  5139         bg_color, bb_color, bb_style,
  5142         text_offset, text_scale, text_spacing,
  5144         text_colors, (
const char * 
const *) text,
  5145         box_colors, box_patterns,
  5146         box_scales, box_line_widths,
  5147         line_colors, line_styles,
  5149         symbol_colors, symbol_scales,
  5150         symbol_numbers, (
const char * 
const *) symbols );
  5152     if ( opt_array != NULL )
  5154     if ( text_colors != NULL )
  5155         free( text_colors );
  5161     if ( box_colors != NULL )
  5163     if ( box_patterns != NULL )
  5164         free( box_patterns );
  5165     if ( box_scales != NULL )
  5167     if ( box_line_widths != NULL )
  5168         free( box_line_widths );
  5169     if ( line_colors != NULL )
  5170         free( line_colors );
  5171     if ( line_styles != NULL )
  5172         free( line_styles );
  5173     if ( line_widths != NULL )
  5174         free( line_widths );
  5175     if ( symbol_colors != NULL )
  5176         free( symbol_colors );
  5177     if ( symbol_scales != NULL )
  5178         free( symbol_scales );
  5179     if ( symbol_numbers != NULL )
  5180         free( symbol_numbers );
  5181     if ( symbols != NULL )
  5187     data[0] = Tcl_NewDoubleObj( (
double) legend_width );
  5188     data[1] = Tcl_NewDoubleObj( (
double) legend_height );
  5189     Tcl_SetObjResult( interp, Tcl_NewListObj( 2, data ) );
  5204     PLFLT     colorbar_width, colorbar_height;
  5205     PLINT     opt, position;
  5206     PLFLT     x, y, x_length, y_length;
  5207     PLINT     bg_color, bb_color, bb_style;
  5208     PLFLT     low_cap_color, high_cap_color;
  5222     Tcl_Obj   *list_vectors;
  5224     PLINT     *vector_sizes;
  5225     PLFLT     **vector_values;
  5238         Tcl_AppendResult( interp, 
"bogus syntax for plcolorbar, see doc.",
  5244     sscanf( argv[1], 
"%d", &opt );
  5245     sscanf( argv[2], 
"%d", &position );
  5246     sscanf( argv[3], 
"%lg", &value ); x        = (
PLFLT) value;
  5247     sscanf( argv[4], 
"%lg", &value ); y        = (
PLFLT) value;
  5248     sscanf( argv[5], 
"%lg", &value ); x_length = (
PLFLT) value;
  5249     sscanf( argv[6], 
"%lg", &value ); y_length = (
PLFLT) value;
  5250     sscanf( argv[7], 
"%d", &bg_color );
  5251     sscanf( argv[8], 
"%d", &bb_color );
  5252     sscanf( argv[9], 
"%d", &bb_style );
  5253     sscanf( argv[10], 
"%lg", &value ); low_cap_color  = (
PLFLT) value;
  5254     sscanf( argv[11], 
"%lg", &value ); high_cap_color = (
PLFLT) value;
  5255     sscanf( argv[12], 
"%d", &cont_color );
  5256     sscanf( argv[13], 
"%lg", &value ); cont_width = (
PLFLT) value;
  5257     label_opts   = 
argv_to_ints( interp, argv[14], &n_label_opts );
  5259     axis_opts    = 
argv_to_chars( interp, argv[16], &n_axis_opts );
  5261     sub_ticks    = 
argv_to_ints( interp, argv[18], &n_sub_ticks );
  5262     list_vectors = Tcl_NewStringObj( argv[19], ( -1 ) );
  5265     if ( n_label_opts != n_labels )
  5267         Tcl_AppendResult( interp, 
"number of label options must equal number of labels.",
  5271     if ( n_axis_opts != n_ticks || n_axis_opts != n_sub_ticks )
  5273         Tcl_AppendResult( interp, 
"number of axis, tick and subtick options must be equal.",
  5277     n_axes = n_axis_opts;
  5279     retcode = Tcl_ListObjLength( interp, list_vectors, &n_vectors );
  5280     if ( retcode != TCL_OK || n_vectors == 0 )
  5282         Tcl_AppendResult( interp, 
"malformed list of vectors or no vector at all.",
  5288         vector_sizes  = (
int *) malloc( 
sizeof ( 
int ) * (size_t) n_vectors );
  5289         vector_values = (
PLFLT **) malloc( 
sizeof ( 
PLFLT * ) * (size_t) n_vectors );
  5290         for ( i = 0; i < n_vectors; i++ )
  5292             Tcl_ListObjIndex( interp, list_vectors, i, &vector );
  5294             if ( vectorPtr->
dim != 1 )
  5296                 Tcl_AppendResult( interp, 
"element in list of vectors is not a vector.",
  5300             vector_sizes[i]  = vectorPtr->
n[0];
  5301             vector_values[i] = vectorPtr->
fdata;
  5306         opt, position, x, y,
  5308         bg_color, bb_color, bb_style,
  5309         low_cap_color, high_cap_color,
  5310         cont_color, cont_width,
  5311         n_labels, label_opts, (
const char * 
const *) labels,
  5312         n_axes, (
const char * 
const *) axis_opts,
  5314         vector_sizes, (
const PLFLT * 
const *) vector_values );
  5316     if ( label_opts != NULL )
  5318     if ( labels != NULL )
  5323     if ( axis_opts != NULL )
  5325         free( axis_opts[0] );
  5328     if ( ticks != NULL )
  5330     if ( sub_ticks != NULL )
  5332     if ( vector_values != NULL )
  5334         free( vector_sizes );
  5335         free( vector_values );
  5338     Tcl_DecrRefCount( list_vectors );
  5340     data[0] = Tcl_NewDoubleObj( (
double) colorbar_width );
  5341     data[1] = Tcl_NewDoubleObj( (
double) colorbar_height );
  5342     Tcl_SetObjResult( interp, Tcl_NewListObj( 2, data ) );
 void c_plstripc(PLINT *id, PLCHAR_VECTOR xspec, PLCHAR_VECTOR yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLINT y_ascl, PLINT acc, PLINT colbox, PLINT collab, PLINT_VECTOR colline, PLINT_VECTOR styline, PLCHAR_MATRIX legline, PLCHAR_VECTOR labx, PLCHAR_VECTOR laby, PLCHAR_VECTOR labtop)
int Pltcl_Init(Tcl_Interp *interp)
static int plslabelfuncCmd(ClientData, Tcl_Interp *, int, const char **)
static PLFLT * argv_to_PLFLTs(Tcl_Interp *interp, const char *list_numbers, int *number)
void plGetName(PLCHAR_VECTOR dir, PLCHAR_VECTOR subdir, PLCHAR_VECTOR filename, char **filespec)
#define CHECK_Tcl_GetMatrixPtr(result, interp, matName)
int(* proc)(void *, struct Tcl_Interp *, int, const char **)
void mapform(PLINT n, PLFLT *x, PLFLT *y)
static int plsurf3dlCmd(ClientData, Tcl_Interp *, int, const char **)
tclMatrix * Tcl_GetMatrixPtr(Tcl_Interp *interp, const char *matName)
static int plcontCmd(ClientData, Tcl_Interp *, int, const char **)
void plmapline(PLMAPFORM_callback mapform, PLCHAR_VECTOR name, PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy, PLINT_VECTOR plotentries, PLINT nplotentries)
#define PLPLOT_IWIDGETS_VERSION
static int cmdTable_initted
static int plmapCmd(ClientData, Tcl_Interp *, int, const char **)
void plmeridians(PLMAPFORM_callback mapform, PLFLT dlong, PLFLT dlat, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat)
static char ** argv_to_chars(Tcl_Interp *interp, const char *list_strings, int *number)
void plmaptex(PLMAPFORM_callback mapform, PLCHAR_VECTOR name, PLFLT dx, PLFLT dy, PLFLT just, PLCHAR_VECTOR text, PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy, PLINT plotentry)
static char * tcl_xform_procname
void plsError(PLINT *errcode, char *errmsg)
static int plstripcCmd(ClientData, Tcl_Interp *, int, const char **)
static int plmaplineCmd(ClientData, Tcl_Interp *, int, const char **)
void c_pllegend(PLFLT *p_legend_width, PLFLT *p_legend_height, PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, PLINT bb_color, PLINT bb_style, PLINT nrow, PLINT ncolumn, PLINT nlegend, PLINT_VECTOR opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLFLT text_justification, PLINT_VECTOR text_colors, PLCHAR_MATRIX text, PLINT_VECTOR box_colors, PLINT_VECTOR box_patterns, PLFLT_VECTOR box_scales, PLFLT_VECTOR box_line_widths, PLINT_VECTOR line_colors, PLINT_VECTOR line_styles, PLFLT_VECTOR line_widths, PLINT_VECTOR symbol_colors, PLFLT_VECTOR symbol_scales, PLINT_VECTOR symbol_numbers, PLCHAR_MATRIX symbols)
static int tclmateval_modx
static int plot3dcCmd(ClientData, Tcl_Interp *, int, const char **)
int plWait_Until(ClientData PL_UNUSED(clientData), Tcl_Interp *interp, int PL_UNUSED(argc), const char **argv)
static int tcl_cmd(Tcl_Interp *interp, const char *cmd)
static int loopbackCmd(ClientData, Tcl_Interp *, int, const char **)
static int plot3dCmd(ClientData, Tcl_Interp *, int, const char **)
static int plsvectCmd(ClientData, Tcl_Interp *, int, const char **)
void plFree2dGrid(PLFLT **f, PLINT nx, PLINT PL_UNUSED(ny))
static int plmaptexCmd(ClientData, Tcl_Interp *, int, const char **)
void c_plimagefr(PLFLT_MATRIX idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, PLTRANSFORM_callback pltr, PLPointer pltr_data)
static void Tcl_transform(PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer PL_UNUSED(data))
static int plsurf3dCmd(ClientData, Tcl_Interp *, int, const char **)
static int plgriddataCmd(ClientData, Tcl_Interp *, int, const char **)
PLDLLIMPEXP char * plplotLibDir
static int plimagefrCmd(ClientData, Tcl_Interp *, int, const char **)
static Tcl_Interp * tcl_interp
static int * argv_to_ints(Tcl_Interp *interp, const char *list_numbers, int *number)
static int plshadesCmd(ClientData, Tcl_Interp *, int, const char **)
static char * tcl_xform_code
static int plmeshCmd(ClientData, Tcl_Interp *, int, const char **)
static Tcl_Obj * label_objs[4]
static int plimageCmd(ClientData, Tcl_Interp *, int, const char **)
static int plmeridiansCmd(ClientData, Tcl_Interp *, int, const char **)
static PLFLT value(double n1, double n2, double hue)
static const char * tcl_xform_template
static int plshadeCmd(ClientData, Tcl_Interp *, int, const char **)
void plmapfill(PLMAPFORM_callback mapform, PLCHAR_VECTOR name, PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy, PLINT_VECTOR plotentries, PLINT nplotentries)
void c_plcolorbar(PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT x_length, PLFLT y_length, PLINT bg_color, PLINT bb_color, PLINT bb_style, PLFLT low_cap_color, PLFLT high_cap_color, PLINT cont_color, PLFLT cont_width, PLINT n_labels, PLINT_VECTOR label_opts, PLCHAR_MATRIX labels, PLINT n_axes, PLCHAR_MATRIX axis_opts, PLFLT_VECTOR ticks, PLINT_VECTOR sub_ticks, PLINT_VECTOR n_values, PLFLT_MATRIX values)
void c_plimage(PLFLT_MATRIX idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax)
int PlbasicInit(Tcl_Interp *interp)
void labelform(PLINT axis, PLFLT value, char *string, PLINT string_length, PLPointer data)
static void set_plplot_parameters(Tcl_Interp *interp)
int pls_auto_path(Tcl_Interp *interp)
char PLDLLIMPEXP * plstrdup(PLCHAR_VECTOR src)
PLFLT tclMatrix_feval(PLINT i, PLINT j, PLPointer p)
#define PLPLOT_ITK_VERSION
static int plmapfillCmd(ClientData, Tcl_Interp *, int, const char **)
static int tclmateval_mody
static int plvectCmd(ClientData, Tcl_Interp *, int, const char **)
int plTclCmd(char *cmdlist, Tcl_Interp *interp, int argc, const char **argv)
int Matrix_Init(Tcl_Interp *interp)
void plAlloc2dGrid(PLFLT ***f, PLINT nx, PLINT ny)
int(* proc)(void *, struct Tcl_Interp *, int, const char **)
static int plsetoptCmd(ClientData, Tcl_Interp *, int, const char **)
static const char * transform_name
static Tcl_HashTable cmdTable
static Tcl_Interp * interp
void plmap(PLMAPFORM_callback mapform, PLCHAR_VECTOR name, PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy)
static int plcolorbarCmd(ClientData, Tcl_Interp *, int, const char **)
static int pllegendCmd(ClientData, Tcl_Interp *, int, const char **)
static int plstransformCmd(ClientData, Tcl_Interp *, int, const char **)
static int plmeshcCmd(ClientData, Tcl_Interp *, int, const char **)
void plmapstring(PLMAPFORM_callback mapform, PLCHAR_VECTOR name, PLCHAR_VECTOR string, PLFLT minx, PLFLT maxx, PLFLT miny, PLFLT maxy, PLINT_VECTOR plotentries, PLINT nplotentries)
#define PLPLOT_ITCL_VERSION
static void Append_Cmdlist(Tcl_Interp *interp)
static Tcl_Interp * tcl_xform_interp
static void plTclCmd_Init(Tcl_Interp *PL_UNUSED(interp))
static int plranddCmd(ClientData, Tcl_Interp *, int, const char **)
PLDLLIMPEXP_CXX void fill(PLINT n, const PLFLT *x, const PLFLT *y)
static int * GetEntries(Tcl_Interp *interp, const char *string, int *n)
static int plmapstringCmd(ClientData, Tcl_Interp *, int, const char **)