38 #ifdef PL_HAVE_UNISTD_H
43 #define getcwd _getcwd
52 static int loopbackCmd( ClientData, Tcl_Interp *,
int,
const char ** );
53 static int plcolorbarCmd( ClientData, Tcl_Interp *,
int,
const char ** );
54 static int plcontCmd( ClientData, Tcl_Interp *,
int,
const char ** );
55 static int pllegendCmd( ClientData, Tcl_Interp *,
int,
const char ** );
56 static int plmeshCmd( ClientData, Tcl_Interp *,
int,
const char ** );
57 static int plmeshcCmd( ClientData, Tcl_Interp *,
int,
const char ** );
58 static int plot3dCmd( ClientData, Tcl_Interp *,
int,
const char ** );
59 static int plot3dcCmd( ClientData, Tcl_Interp *,
int,
const char ** );
60 static int plsurf3dCmd( ClientData, Tcl_Interp *,
int,
const char ** );
61 static int plsetoptCmd( ClientData, Tcl_Interp *,
int,
const char ** );
62 static int plshadeCmd( ClientData, Tcl_Interp *,
int,
const char ** );
63 static int plshadesCmd( ClientData, Tcl_Interp *,
int,
const char ** );
64 static int plmapCmd( ClientData, Tcl_Interp *,
int,
const char ** );
65 static int plmeridiansCmd( ClientData, Tcl_Interp *,
int,
const char ** );
66 static int plstransformCmd( ClientData, Tcl_Interp *,
int,
const char ** );
67 static int plvectCmd( ClientData, Tcl_Interp *,
int,
const char ** );
68 static int plranddCmd( ClientData, Tcl_Interp *,
int,
const char ** );
69 static int plgriddataCmd( ClientData, Tcl_Interp *,
int,
const char ** );
70 static int plimageCmd( ClientData, Tcl_Interp *,
int,
const char ** );
71 static int plimagefrCmd( ClientData, Tcl_Interp *,
int,
const char ** );
72 static int plstripcCmd( ClientData, Tcl_Interp *,
int,
const char ** );
73 static int plslabelfuncCmd( ClientData, Tcl_Interp *,
int,
const char ** );
85 int ( *
proc )(
void *,
struct Tcl_Interp *, int,
const char ** );
96 int ( *proc )(
void *,
struct Tcl_Interp *, int,
const char ** );
141 #define PL_LIBRARY ""
146 #if ( !defined ( MAC_TCL ) && !defined ( __WIN32__ ) )
152 #define PLPLOT_EXTENDED_SEARCH
171 static int inited = 0;
172 static const char** namelist;
173 int i, j, ncmds =
sizeof (
Cmds ) /
sizeof (
CmdInfo );
177 namelist = (
const char **) malloc( (
size_t) ncmds *
sizeof (
char * ) );
179 for ( i = 0; i < ncmds; i++ )
180 namelist[i] = Cmds[i].
name;
184 for ( i = 0; i < ncmds - 1; i++ )
185 for ( j = i + 1; j < ncmds - 1; j++ )
187 if ( strcmp( namelist[i], namelist[j] ) > 0 )
189 const char *t = namelist[i];
190 namelist[i] = namelist[j];
198 for ( i = 0; i < ncmds; i++ )
199 Tcl_AppendResult( interp,
" ", namelist[i], (
char *) NULL );
223 Tcl_InitHashTable( &
cmdTable, TCL_STRING_KEYS );
227 for ( cmdInfoPtr = Cmds; cmdInfoPtr->
name != NULL; cmdInfoPtr++ )
232 hPtr = Tcl_CreateHashEntry( &
cmdTable, cmdInfoPtr->
name, &
new );
240 Tcl_SetHashValue( hPtr, cmdPtr );
269 register Tcl_HashEntry *hPtr;
286 Tcl_AppendResult( interp, cmdlist, (
char *) NULL );
293 hPtr = Tcl_FindHashEntry( &
cmdTable, argv[0] );
296 Tcl_AppendResult( interp,
"bad option \"", argv[0],
297 "\" to \"cmd\": must be one of ",
298 cmdlist, (
char *) NULL );
305 result = ( *cmdPtr->
proc )( cmdPtr->
clientData, interp, argc, argv );
306 if ( result == TCL_OK )
311 Tcl_AppendResult( interp,
errmsg, (
char *) NULL );
337 register Tcl_HashEntry *hPtr;
341 if ( argc == 0 || ( strcmp( argv[0],
"cmd" ) != 0 ) )
343 Tcl_AppendResult( interp,
"bad option \"", argv[0],
344 "\" to \"loopback\": must be ",
345 "\"cmd ?options?\" ", (
char *) NULL );
368 hPtr = Tcl_FindHashEntry( &
cmdTable, argv[0] );
371 Tcl_AppendResult( interp,
"bad option \"", argv[0],
372 "\" to \"loopback cmd\": must be one of ",
380 result = ( *cmdPtr->
proc )( cmdPtr->
clientData, interp, argc, argv );
398 int debug = plsc->debug;
399 const char *libDir = NULL;
400 static char initScript[] =
401 "tcl_findLibrary plplot " VERSION " \"\" plplot.tcl PL_LIBRARY pllibrary";
402 #ifdef PLPLOT_EXTENDED_SEARCH
403 static char initScriptExtended[] =
404 "tcl_findLibrary plplot " VERSION "/tcl \"\" plplot.tcl PL_LIBRARY pllibrary";
414 Tcl_InitStubs( interp,
"8.1", 0 );
421 fprintf( stderr,
"error in matrix init\n" );
432 #ifdef USE_MATRIX_STUBS
433 if ( Matrix_InitStubs( interp,
"0.1", 0 ) == NULL )
436 fprintf( stderr,
"error in matrix stubs init\n" );
440 Tcl_PkgRequire( interp,
"Matrix",
"0.1", 0 );
444 Tcl_SetVar( interp,
"plversion",
VERSION, TCL_GLOBAL_ONLY );
454 fprintf( stderr,
"trying BUILD_DIR\n" );
456 Tcl_SetVar( interp,
"pllibrary", libDir, TCL_GLOBAL_ONLY );
457 if ( Tcl_Eval( interp, initScript ) != TCL_OK )
460 Tcl_UnsetVar( interp,
"pllibrary", TCL_GLOBAL_ONLY );
461 Tcl_ResetResult( interp );
466 if ( libDir == NULL )
469 fprintf( stderr,
"trying init script\n" );
470 if ( Tcl_Eval( interp, initScript ) != TCL_OK )
473 Tcl_UnsetVar( interp,
"pllibrary", TCL_GLOBAL_ONLY );
475 Tcl_ResetResult( interp );
478 libDir = Tcl_GetVar( interp,
"pllibrary", TCL_GLOBAL_ONLY );
483 if ( libDir == NULL )
486 fprintf( stderr,
"trying TCL_DIR\n" );
488 Tcl_SetVar( interp,
"pllibrary", libDir, TCL_GLOBAL_ONLY );
489 if ( Tcl_Eval( interp, initScript ) != TCL_OK )
492 Tcl_UnsetVar( interp,
"pllibrary", TCL_GLOBAL_ONLY );
493 Tcl_ResetResult( interp );
498 #ifdef PLPLOT_EXTENDED_SEARCH
500 if ( libDir == NULL )
503 fprintf( stderr,
"trying extended init script\n" );
504 if ( Tcl_Eval( interp, initScriptExtended ) != TCL_OK )
507 Tcl_UnsetVar( interp,
"pllibrary", TCL_GLOBAL_ONLY );
509 Tcl_ResetResult( interp );
512 libDir = Tcl_GetVar( interp,
"pllibrary", TCL_GLOBAL_ONLY );
516 if ( libDir == NULL )
520 fprintf( stderr,
"trying curdir\n" );
521 if ( Tcl_Access(
"plplot.tcl", 0 ) != 0 )
524 fprintf( stderr,
"couldn't find plplot.tcl in curdir\n" );
529 libDir = Tcl_GetCwd( interp, &ds );
530 if ( libDir == NULL )
533 fprintf( stderr,
"couldn't get curdir\n" );
537 Tcl_DStringFree( &ds );
538 Tcl_SetVar( interp,
"pllibrary", libDir, TCL_GLOBAL_ONLY );
540 if ( Tcl_EvalFile( interp,
"plplot.tcl" ) != TCL_OK )
543 fprintf( stderr,
"error evalling plplot.tcl\n" );
549 if ( libDir == NULL )
552 fprintf( stderr,
"libdir NULL at end of search\n" );
562 Tcl_CreateCommand( interp,
"wait_until", (Tcl_CmdProc *)
plWait_Until,
563 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
583 Tcl_AppendResult( interp,
"Could not find plplot.tcl - please set \
584 environment variable PL_LIBRARY to the directory containing that file",
596 for ( cmdInfoPtr = Cmds; cmdInfoPtr->
name != NULL; cmdInfoPtr++ )
598 Tcl_CreateCommand( interp, cmdInfoPtr->
name, cmdInfoPtr->
proc,
599 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
609 Tcl_PkgProvide( interp,
"Pltcl",
VERSION );
637 if ( Tcl_ExprBoolean( interp, argv[1], &result ) )
639 fprintf( stderr,
"wait_until command \"%s\" failed:\n\t %s\n",
640 argv[1], Tcl_GetStringResult( interp ) );
666 char *
buf, *ptr = NULL, *dn;
672 buf = (
char *) malloc( 256 *
sizeof (
char ) );
677 Tcl_SetVar( interp,
"dir",
TCL_DIR, TCL_GLOBAL_ONLY );
678 if (
tcl_cmd( interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
680 return_code = TCL_ERROR;
684 fprintf( stderr,
"adding %s to auto_path\n",
TCL_DIR );
685 path = Tcl_GetVar( interp,
"auto_path", 0 );
686 fprintf( stderr,
"auto_path is %s\n", path );
692 if ( ( dn = getenv(
"HOME" ) ) != NULL )
695 Tcl_SetVar( interp,
"dir", ptr, 0 );
696 if (
tcl_cmd( interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
698 return_code = TCL_ERROR;
702 fprintf( stderr,
"adding %s to auto_path\n", ptr );
703 path = Tcl_GetVar( interp,
"auto_path", 0 );
704 fprintf( stderr,
"auto_path is %s\n", path );
710 #if defined ( PL_TCL_ENV )
711 if ( ( dn = getenv( PL_TCL_ENV ) ) != NULL )
714 Tcl_SetVar( interp,
"dir", ptr, 0 );
715 if (
tcl_cmd( interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
717 return_code = TCL_ERROR;
721 fprintf( stderr,
"adding %s to auto_path\n", ptr );
722 path = Tcl_GetVar( interp,
"auto_path", 0 );
723 fprintf( stderr,
"auto_path is %s\n", path );
730 #if defined ( PL_HOME_ENV )
731 if ( ( dn = getenv( PL_HOME_ENV ) ) != NULL )
734 Tcl_SetVar( interp,
"dir", ptr, 0 );
735 if (
tcl_cmd( interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
737 return_code = TCL_ERROR;
741 fprintf( stderr,
"adding %s to auto_path\n", ptr );
742 path = Tcl_GetVar( interp,
"auto_path", 0 );
743 fprintf( stderr,
"auto_path is %s\n", path );
746 #endif // PL_HOME_ENV
750 if ( getcwd( buf, 256 ) == 0 )
752 Tcl_SetResult( interp,
"Problems with getcwd in pls_auto_path", TCL_STATIC );
754 return_code = TCL_ERROR;
758 Tcl_SetVar( interp,
"dir", buf, 0 );
759 if (
tcl_cmd( interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
761 return_code = TCL_ERROR;
767 Tcl_SetVar( interp,
"dir",
BUILD_DIR "/bindings/tk", TCL_GLOBAL_ONLY );
768 if (
tcl_cmd( interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
770 return_code = TCL_ERROR;
776 fprintf( stderr,
"adding %s to auto_path\n", buf );
777 path = Tcl_GetVar( interp,
"auto_path", 0 );
778 fprintf( stderr,
"auto_path is %s\n", path );
798 result = Tcl_VarEval( interp, cmd, (
char **) NULL );
799 if ( result != TCL_OK )
801 fprintf( stderr,
"TCL command \"%s\" failed:\n\t %s\n",
802 cmd, Tcl_GetStringResult( interp ) );
872 PLINT nx,
ny, kx = 0, lx = 0, ky = 0, ly = 0, nclev;
873 const char *pltrname =
"pltr0";
874 tclMatrix *mattrx = NULL, *mattry = NULL;
875 PLFLT **z, **zused, **zwrapped;
877 int arg3_is_kx = 1, i, j;
887 Tcl_AppendResult( interp,
"wrong # args: see documentation for ",
888 argv[0], (
char *) NULL );
896 if ( matf->
dim != 2 )
898 Tcl_SetResult( interp,
"Must use 2-d data.", TCL_STATIC );
905 tclmateval_modx =
nx;
906 tclmateval_mody =
ny;
911 for ( i = 0; i <
nx; i++ )
913 for ( j = 0; j <
ny; j++ )
923 for ( i = 0; i < (int) strlen( argv[2] ) && arg3_is_kx; i++ )
924 if ( !isdigit( argv[2][i] ) )
932 Tcl_SetResult( interp,
"plcont, bogus syntax", TCL_STATIC );
937 kx = atoi( argv[3] );
938 lx = atoi( argv[4] );
939 ky = atoi( argv[5] );
940 ly = atoi( argv[6] );
943 argc -= 6, argv += 6;
947 argc -= 2, argv += 2;
954 Tcl_SetResult( interp,
"plcont, bogus syntax", TCL_STATIC );
959 if ( matclev == NULL )
961 nclev = matclev->
n[0];
963 if ( matclev->
dim != 1 )
965 Tcl_SetResult( interp,
"clev must be 1-d matrix.", TCL_STATIC );
978 if ( mattrx == NULL )
981 if ( mattry == NULL )
984 argc -= 3, argv += 3;
990 wrap = atoi( argv[0] );
1002 Tcl_SetResult( interp,
"plcont, bogus syntax, too many args.", TCL_STATIC );
1008 if ( !strcmp( pltrname,
"pltr0" ) )
1016 Tcl_SetResult( interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
1020 else if ( !strcmp( pltrname,
"pltr1" ) )
1025 cgrid1.
yg = mattry->fdata;
1032 Tcl_SetResult( interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
1036 if ( mattrx->
dim != 1 || mattry->dim != 1 )
1038 Tcl_SetResult( interp,
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
1042 pltr_data = &cgrid1;
1044 else if ( !strcmp( pltrname,
"pltr2" ) )
1057 for ( i = 0; i <
nx; i++ )
1058 for ( j = 0; j <
ny; j++ )
1059 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1062 for ( i = 0; i <
nx; i++ )
1063 for ( j = 0; j <
ny; j++ )
1064 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1066 else if ( wrap == 1 )
1076 for ( i = 0; i <
nx; i++ )
1077 for ( j = 0; j <
ny; j++ )
1078 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1081 for ( i = 0; i <
nx; i++ )
1083 for ( j = 0; j <
ny; j++ )
1085 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1086 zwrapped[i][j] = z[i][j];
1090 for ( j = 0; j <
ny; j++ )
1092 cgrid2.
xg[
nx][j] = cgrid2.
xg[0][j];
1093 cgrid2.
yg[
nx][j] = cgrid2.
yg[0][j];
1094 zwrapped[
nx][j] = zwrapped[0][j];
1103 else if ( wrap == 2 )
1113 for ( i = 0; i <
nx; i++ )
1114 for ( j = 0; j <
ny; j++ )
1115 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1118 for ( i = 0; i <
nx; i++ )
1120 for ( j = 0; j <
ny; j++ )
1122 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1123 zwrapped[i][j] = z[i][j];
1127 for ( i = 0; i <
nx; i++ )
1129 cgrid2.
xg[i][
ny] = cgrid2.
xg[i][0];
1130 cgrid2.
yg[i][
ny] = cgrid2.
yg[i][0];
1131 zwrapped[i][
ny] = zwrapped[i][0];
1142 Tcl_SetResult( interp,
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
1147 pltr_data = &cgrid2;
1151 Tcl_AppendResult( interp,
1152 "Unrecognized coordinate transformation spec:",
1153 pltrname,
", must be pltr0 pltr1 or pltr2.",
1171 plcont( (
const PLFLT *
const *) zused, nx, ny,
1173 matclev->
fdata, nclev,
1209 const char *pltrname =
"pltr0";
1210 tclMatrix *mattrx = NULL, *mattry = NULL;
1211 PLFLT **u, **v, **uused, **vused, **uwrapped, **vwrapped;
1224 Tcl_AppendResult( interp,
"wrong # args: see documentation for ",
1225 argv[0], (
char *) NULL );
1233 if ( matu->
dim != 2 )
1235 Tcl_SetResult( interp,
"Must use 2-d data.", TCL_STATIC );
1242 tclmateval_modx =
nx;
1243 tclmateval_mody =
ny;
1248 for ( i = 0; i <
nx; i++ )
1250 for ( j = 0; j <
ny; j++ )
1261 if ( matv->
dim != 2 )
1263 Tcl_SetResult( interp,
"Must use 2-d data.", TCL_STATIC );
1270 tclmateval_modx =
nx;
1271 tclmateval_mody =
ny;
1276 for ( i = 0; i <
nx; i++ )
1278 for ( j = 0; j <
ny; j++ )
1285 argc -= 3, argv += 3;
1291 Tcl_SetResult( interp,
"plvect, bogus syntax", TCL_STATIC );
1295 scaling = atof( argv[0] );
1305 if ( mattrx == NULL )
1308 if ( mattry == NULL )
1311 argc -= 3, argv += 3;
1317 wrap = atoi( argv[0] );
1329 Tcl_SetResult( interp,
"plvect, bogus syntax, too many args.", TCL_STATIC );
1335 if ( !strcmp( pltrname,
"pltr0" ) )
1344 Tcl_SetResult( interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
1348 else if ( !strcmp( pltrname,
"pltr1" ) )
1353 cgrid1.
yg = mattry->fdata;
1361 Tcl_SetResult( interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
1365 if ( mattrx->
dim != 1 || mattry->dim != 1 )
1367 Tcl_SetResult( interp,
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
1371 pltr_data = &cgrid1;
1373 else if ( !strcmp( pltrname,
"pltr2" ) )
1387 for ( i = 0; i <
nx; i++ )
1388 for ( j = 0; j <
ny; j++ )
1389 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1391 for ( i = 0; i <
nx; i++ )
1393 for ( j = 0; j <
ny; j++ )
1395 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1399 else if ( wrap == 1 )
1412 for ( i = 0; i <
nx; i++ )
1413 for ( j = 0; j <
ny; j++ )
1414 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1417 for ( i = 0; i <
nx; i++ )
1419 for ( j = 0; j <
ny; j++ )
1421 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1422 uwrapped[i][j] = u[i][j];
1423 vwrapped[i][j] = v[i][j];
1427 for ( j = 0; j <
ny; j++ )
1429 cgrid2.
xg[
nx][j] = cgrid2.
xg[0][j];
1430 cgrid2.
yg[
nx][j] = cgrid2.
yg[0][j];
1431 uwrapped[
nx][j] = uwrapped[0][j];
1432 vwrapped[
nx][j] = vwrapped[0][j];
1441 else if ( wrap == 2 )
1453 for ( i = 0; i <
nx; i++ )
1454 for ( j = 0; j <
ny; j++ )
1455 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1458 for ( i = 0; i <
nx; i++ )
1460 for ( j = 0; j <
ny; j++ )
1462 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1463 uwrapped[i][j] = u[i][j];
1464 vwrapped[i][j] = v[i][j];
1468 for ( i = 0; i <
nx; i++ )
1470 cgrid2.
xg[i][
ny] = cgrid2.
xg[i][0];
1471 cgrid2.
yg[i][
ny] = cgrid2.
yg[i][0];
1472 uwrapped[i][
ny] = uwrapped[i][0];
1473 vwrapped[i][
ny] = vwrapped[i][0];
1485 Tcl_SetResult( interp,
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
1490 pltr_data = &cgrid2;
1494 Tcl_AppendResult( interp,
1495 "Unrecognized coordinate transformation spec:",
1496 pltrname,
", must be pltr0 pltr1 or pltr2.",
1504 plvect( (
const PLFLT *
const *) uused, (
const PLFLT *
const *) vused, nx, ny,
1505 scaling,
pltr, pltr_data );
1558 nx = atoi( argv[4] );
1559 ny = atoi( argv[5] );
1560 opt = atoi( argv[6] );
1577 Tcl_SetResult( interp,
"x y and z must all be float", TCL_STATIC );
1581 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1582 maty->
dim != 1 || maty->
n[0] != ny ||
1583 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
1585 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
1592 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1593 for ( i = 0; i <
nx; i++ )
1594 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1596 else if ( argc == 5 )
1598 opt = atoi( argv[4] );
1615 Tcl_SetResult( interp,
"x y and z must all be float", TCL_STATIC );
1619 nx = matx->
n[0]; ny = maty->
n[0];
1621 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1622 maty->
dim != 1 || maty->
n[0] != ny ||
1623 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
1625 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
1632 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1633 for ( i = 0; i <
nx; i++ )
1634 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1636 else if ( argc == 3 )
1638 Tcl_SetResult( interp,
"unimplemented", TCL_STATIC );
1643 Tcl_AppendResult( interp,
"wrong # args: should be \"plmesh ",
1644 "x y z nx ny opt\", or a valid contraction ",
1645 "thereof.", (
char *) NULL );
1649 plmesh( x, y, (
const PLFLT *
const *) z, nx, ny, opt );
1655 else if ( argc == 5 )
1693 tclMatrix *matx, *maty, *matz, *matPtr, *matlev;
1698 nlev = atoi( argv[8] );
1699 nx = atoi( argv[4] );
1700 ny = atoi( argv[5] );
1701 opt = atoi( argv[6] );
1715 if ( matlev == NULL )
1723 Tcl_SetResult( interp,
"x y z and clevel must all be float", TCL_STATIC );
1727 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1728 maty->
dim != 1 || maty->
n[0] != ny ||
1729 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
1730 matlev->
dim != 1 || matlev->
n[0] != nlev )
1732 Tcl_SetResult( interp,
"popo Inconsistent dimensions", TCL_STATIC );
1738 clev = matlev->
fdata;
1740 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1741 for ( i = 0; i <
nx; i++ )
1742 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1745 else if ( argc == 8 )
1747 nx = atoi( argv[4] );
1748 ny = atoi( argv[5] );
1749 opt = atoi( argv[6] );
1762 if ( matlev == NULL )
1770 Tcl_SetResult( interp,
"x y z and clevel must all be float", TCL_STATIC );
1774 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1775 maty->
dim != 1 || maty->
n[0] != ny ||
1776 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
1777 matlev->
dim != 1 || matlev->
n[0] != nlev )
1779 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
1785 clev = matlev->
fdata;
1786 nlev = matlev->
n[0];
1788 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1789 for ( i = 0; i <
nx; i++ )
1790 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1793 else if ( argc == 7 )
1795 nx = atoi( argv[4] );
1796 ny = atoi( argv[5] );
1797 opt = atoi( argv[6] );
1815 Tcl_SetResult( interp,
"x y and z must all be float", TCL_STATIC );
1819 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1820 maty->
dim != 1 || maty->
n[0] != ny ||
1821 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
1823 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
1830 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1831 for ( i = 0; i <
nx; i++ )
1832 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1834 else if ( argc == 5 )
1836 opt = atoi( argv[4] );
1854 Tcl_SetResult( interp,
"x y and z must all be float", TCL_STATIC );
1858 nx = matx->
n[0]; ny = maty->
n[0];
1860 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1861 maty->
dim != 1 || maty->
n[0] != ny ||
1862 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
1864 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
1871 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1872 for ( i = 0; i <
nx; i++ )
1873 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1875 else if ( argc == 3 )
1877 Tcl_SetResult( interp,
"unimplemented", TCL_STATIC );
1882 Tcl_AppendResult( interp,
"wrong # args: should be \"plmeshc ",
1883 "x y z nx ny opt clevel nlevel\", or a valid contraction ",
1884 "thereof.", (
char *) NULL );
1888 plmeshc( x, y, (
const PLFLT *
const *) z, nx, ny, opt, clev, nlev );
1894 else if ( argc == 5 )
1932 nx = atoi( argv[4] );
1933 ny = atoi( argv[5] );
1934 opt = atoi( argv[6] );
1935 side = atoi( argv[7] );
1952 Tcl_SetResult( interp,
"x y and z must all be float", TCL_STATIC );
1956 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1957 maty->
dim != 1 || maty->
n[0] != ny ||
1958 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
1960 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
1967 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1968 for ( i = 0; i <
nx; i++ )
1969 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1971 else if ( argc == 6 )
1973 opt = atoi( argv[4] );
1974 side = atoi( argv[5] );
1991 Tcl_SetResult( interp,
"x y and z must all be float", TCL_STATIC );
1995 nx = matx->
n[0]; ny = maty->
n[0];
1997 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1998 maty->
dim != 1 || maty->
n[0] != ny ||
1999 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
2001 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
2008 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2009 for ( i = 0; i <
nx; i++ )
2010 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2012 else if ( argc == 4 )
2014 Tcl_SetResult( interp,
"unimplemented", TCL_STATIC );
2019 Tcl_AppendResult( interp,
"wrong # args: should be \"plot3d ",
2020 "x y z nx ny opt side\", or a valid contraction ",
2021 "thereof.", (
char *) NULL );
2025 plot3d( x, y, (
const PLFLT *
const *) z, nx, ny, opt, side );
2031 else if ( argc == 6 )
2069 tclMatrix *matx, *maty, *matz, *matPtr, *matlev;
2074 nlev = atoi( argv[8] );
2075 nx = atoi( argv[4] );
2076 ny = atoi( argv[5] );
2077 opt = atoi( argv[6] );
2091 if ( matlev == NULL )
2099 Tcl_SetResult( interp,
"x y z and clevel must all be float", TCL_STATIC );
2103 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2104 maty->
dim != 1 || maty->
n[0] != ny ||
2105 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2106 matlev->
dim != 1 || matlev->
n[0] != nlev )
2108 Tcl_SetResult( interp,
"popo Inconsistent dimensions", TCL_STATIC );
2114 clev = matlev->
fdata;
2116 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2117 for ( i = 0; i <
nx; i++ )
2118 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2121 else if ( argc == 8 )
2123 nx = atoi( argv[4] );
2124 ny = atoi( argv[5] );
2125 opt = atoi( argv[6] );
2138 if ( matlev == NULL )
2146 Tcl_SetResult( interp,
"x y z and clevel must all be float", TCL_STATIC );
2150 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2151 maty->
dim != 1 || maty->
n[0] != ny ||
2152 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2153 matlev->
dim != 1 || matlev->
n[0] != nlev )
2155 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
2161 clev = matlev->
fdata;
2162 nlev = matlev->
n[0];
2164 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2165 for ( i = 0; i <
nx; i++ )
2166 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2169 else if ( argc == 7 )
2171 nx = atoi( argv[4] );
2172 ny = atoi( argv[5] );
2173 opt = atoi( argv[6] );
2191 Tcl_SetResult( interp,
"x y and z must all be float", TCL_STATIC );
2195 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2196 maty->
dim != 1 || maty->
n[0] != ny ||
2197 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
2199 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
2206 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2207 for ( i = 0; i <
nx; i++ )
2208 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2210 else if ( argc == 5 )
2212 opt = atoi( argv[4] );
2230 Tcl_SetResult( interp,
"x y and z must all be float", TCL_STATIC );
2234 nx = matx->
n[0]; ny = maty->
n[0];
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 )
2240 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
2247 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2248 for ( i = 0; i <
nx; i++ )
2249 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2251 else if ( argc == 3 )
2253 Tcl_SetResult( interp,
"unimplemented", TCL_STATIC );
2258 Tcl_AppendResult( interp,
"wrong # args: should be \"plot3dc ",
2259 "x y z nx ny opt clevel nlevel\", or a valid contraction ",
2260 "thereof.", (
char *) NULL );
2264 plot3dc( x, y, (
const PLFLT *
const *) z, nx, ny, opt, clev, nlev );
2270 else if ( argc == 5 )
2308 tclMatrix *matx, *maty, *matz, *matPtr, *matlev;
2313 nlev = atoi( argv[8] );
2314 nx = atoi( argv[4] );
2315 ny = atoi( argv[5] );
2316 opt = atoi( argv[6] );
2330 if ( matlev == NULL )
2338 Tcl_SetResult( interp,
"x y z and clevel must all be float", TCL_STATIC );
2342 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2343 maty->
dim != 1 || maty->
n[0] != ny ||
2344 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2345 matlev->
dim != 1 || matlev->
n[0] != nlev )
2347 Tcl_SetResult( interp,
"popo Inconsistent dimensions", TCL_STATIC );
2353 clev = matlev->
fdata;
2355 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2356 for ( i = 0; i <
nx; i++ )
2357 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2360 else if ( argc == 8 )
2362 nx = atoi( argv[4] );
2363 ny = atoi( argv[5] );
2364 opt = atoi( argv[6] );
2377 if ( matlev == NULL )
2385 Tcl_SetResult( interp,
"x y z and clevel must all be float", TCL_STATIC );
2389 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2390 maty->
dim != 1 || maty->
n[0] != ny ||
2391 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2392 matlev->
dim != 1 || matlev->
n[0] != nlev )
2394 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
2400 clev = matlev->
fdata;
2401 nlev = matlev->
n[0];
2403 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2404 for ( i = 0; i <
nx; i++ )
2405 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2408 else if ( argc == 7 )
2410 nx = atoi( argv[4] );
2411 ny = atoi( argv[5] );
2412 opt = atoi( argv[6] );
2430 Tcl_SetResult( interp,
"x y and z must all be float", TCL_STATIC );
2434 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2435 maty->
dim != 1 || maty->
n[0] != ny ||
2436 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
2438 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
2445 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2446 for ( i = 0; i <
nx; i++ )
2447 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2449 else if ( argc == 5 )
2451 opt = atoi( argv[4] );
2469 Tcl_SetResult( interp,
"x y and z must all be float", TCL_STATIC );
2473 nx = matx->
n[0]; ny = maty->
n[0];
2475 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2476 maty->
dim != 1 || maty->
n[0] != ny ||
2477 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
2479 Tcl_SetResult( interp,
"Inconsistent dimensions", TCL_STATIC );
2486 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2487 for ( i = 0; i <
nx; i++ )
2488 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2490 else if ( argc == 3 )
2492 Tcl_SetResult( interp,
"unimplemented", TCL_STATIC );
2497 Tcl_AppendResult( interp,
"wrong # args: should be \"plsurf3d ",
2498 "x y z nx ny opt clevel nlevel\", or a valid contraction ",
2499 "thereof.", (
char *) NULL );
2503 plsurf3d( x, y, (
const PLFLT *
const *) z, nx, ny, opt, clev, nlev );
2509 else if ( argc == 5 )
2533 Tcl_AppendResult( interp,
"wrong # args: ",
2534 argv[0],
" takes no arguments", (
char *) NULL );
2539 Tcl_SetObjResult( interp, Tcl_NewDoubleObj(
plrandd() ) );
2554 if ( argc < 2 || argc > 3 )
2556 Tcl_AppendResult( interp,
"wrong # args: should be \"",
2557 argv[0],
" option ?argument?\"", (
char *) NULL );
2596 tclMatrix *matPtr, *matz, *mattrx = NULL, *mattry = NULL;
2597 PLFLT **z, **zused, **zwrapped;
2602 PLINT min_col = 1, max_col = 0;
2603 PLFLT min_wid = 0., max_wid = 0.;
2605 const char *pltrname =
"pltr0";
2615 Tcl_AppendResult( interp,
"bogus syntax for plshade, see doc.",
2623 if ( matz->
dim != 2 )
2625 Tcl_SetResult( interp,
"Must plot a 2-d matrix.", TCL_STATIC );
2632 tclmateval_modx =
nx;
2633 tclmateval_mody =
ny;
2638 for ( i = 0; i <
nx; i++ )
2640 for ( j = 0; j <
ny; j++ )
2646 xmin = atof( argv[2] );
2647 xmax = atof( argv[3] );
2648 ymin = atof( argv[4] );
2649 ymax = atof( argv[5] );
2650 sh_min = atof( argv[6] );
2651 sh_max = atof( argv[7] );
2652 sh_cmap = atoi( argv[8] );
2653 sh_col = atof( argv[9] );
2654 sh_wid = atof( argv[10] );
2655 min_col = atoi( argv[11] );
2656 min_wid = atoi( argv[12] );
2657 max_col = atoi( argv[13] );
2658 max_wid = atof( argv[14] );
2659 rect = atoi( argv[15] );
2661 argc -= 16, argv += 16;
2667 if ( mattrx == NULL )
2670 if ( mattry == NULL )
2673 argc -= 3, argv += 3;
2675 else if ( argc && !strcmp( argv[0],
"NULL" ) )
2678 argc -= 1, argv += 1;
2683 wrap = atoi( argv[0] );
2689 Tcl_SetResult( interp,
"plshade: bogus arg list", TCL_STATIC );
2696 if ( !strcmp( pltrname,
"NULL" ) )
2704 Tcl_SetResult( interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
2708 else if ( !strcmp( pltrname,
"pltr0" ) )
2716 Tcl_SetResult( interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
2720 else if ( !strcmp( pltrname,
"pltr1" ) )
2725 cgrid1.
yg = mattry->fdata;
2732 Tcl_SetResult( interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
2736 if ( mattrx->
dim != 1 || mattry->dim != 1 )
2738 Tcl_SetResult( interp,
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
2742 pltr_data = &cgrid1;
2744 else if ( !strcmp( pltrname,
"pltr2" ) )
2757 for ( i = 0; i <
nx; i++ )
2758 for ( j = 0; j <
ny; j++ )
2759 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
2762 for ( i = 0; i <
nx; i++ )
2763 for ( j = 0; j <
ny; j++ )
2764 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
2766 else if ( wrap == 1 )
2776 for ( i = 0; i <
nx; i++ )
2777 for ( j = 0; j <
ny; j++ )
2778 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
2781 for ( i = 0; i <
nx; i++ )
2783 for ( j = 0; j <
ny; j++ )
2785 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
2786 zwrapped[i][j] = z[i][j];
2790 for ( j = 0; j <
ny; j++ )
2792 cgrid2.
xg[
nx][j] = cgrid2.
xg[0][j];
2793 cgrid2.
yg[
nx][j] = cgrid2.
yg[0][j];
2794 zwrapped[
nx][j] = zwrapped[0][j];
2803 else if ( wrap == 2 )
2813 for ( i = 0; i <
nx; i++ )
2814 for ( j = 0; j <
ny; j++ )
2815 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
2818 for ( i = 0; i <
nx; i++ )
2820 for ( j = 0; j <
ny; j++ )
2822 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
2823 zwrapped[i][j] = z[i][j];
2827 for ( i = 0; i <
nx; i++ )
2829 cgrid2.
xg[i][
ny] = cgrid2.
xg[i][0];
2830 cgrid2.
yg[i][
ny] = cgrid2.
yg[i][0];
2831 zwrapped[i][
ny] = zwrapped[i][0];
2842 Tcl_SetResult( interp,
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
2847 pltr_data = &cgrid2;
2851 Tcl_AppendResult( interp,
2852 "Unrecognized coordinate transformation spec:",
2853 pltrname,
", must be NULL, pltr0, pltr1, or pltr2.",
2860 plshade( (
const PLFLT *
const *) zused, nx, ny, NULL,
2861 xmin, xmax, ymin, ymax,
2862 sh_min, sh_max, sh_cmap, sh_col, sh_wid,
2863 min_col, min_wid, max_col, max_wid,
2919 tclMatrix *matPtr, *matz, *mattrx = NULL, *mattry = NULL;
2921 PLFLT **z, **zused, **zwrapped;
2926 const char *pltrname =
"pltr0";
2932 int nx,
ny, nlevel, i, j;
2936 Tcl_AppendResult( interp,
"bogus syntax for plshades, see doc.",
2944 if ( matz->
dim != 2 )
2946 Tcl_SetResult( interp,
"Must plot a 2-d matrix.", TCL_STATIC );
2953 tclmateval_modx =
nx;
2954 tclmateval_mody =
ny;
2959 for ( i = 0; i <
nx; i++ )
2961 for ( j = 0; j <
ny; j++ )
2967 xmin = atof( argv[2] );
2968 xmax = atof( argv[3] );
2969 ymin = atof( argv[4] );
2970 ymax = atof( argv[5] );
2973 if ( matclevel == NULL )
2975 nlevel = matclevel->
n[0];
2976 if ( matclevel->
dim != 1 )
2978 Tcl_SetResult( interp,
"clevel must be 1-d matrix.", TCL_STATIC );
2982 fill_width = atof( argv[7] );
2983 cont_color = atoi( argv[8] );
2985 rect = atoi( argv[10] );
2987 argc -= 11, argv += 11;
2993 if ( mattrx == NULL )
2996 if ( mattry == NULL )
2999 argc -= 3, argv += 3;
3001 else if ( argc && !strcmp( argv[0],
"NULL" ) )
3004 argc -= 1, argv += 1;
3009 wrap = atoi( argv[0] );
3015 Tcl_SetResult( interp,
"plshades: bogus arg list", TCL_STATIC );
3022 if ( !strcmp( pltrname,
"NULL" ) )
3030 Tcl_SetResult( interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
3034 else if ( !strcmp( pltrname,
"pltr0" ) )
3042 Tcl_SetResult( interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
3046 else if ( !strcmp( pltrname,
"pltr1" ) )
3051 cgrid1.
yg = mattry->fdata;
3058 Tcl_SetResult( interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
3062 if ( mattrx->
dim != 1 || mattry->dim != 1 )
3064 Tcl_SetResult( interp,
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
3068 pltr_data = &cgrid1;
3070 else if ( !strcmp( pltrname,
"pltr2" ) )
3083 for ( i = 0; i <
nx; i++ )
3084 for ( j = 0; j <
ny; j++ )
3085 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
3088 for ( i = 0; i <
nx; i++ )
3089 for ( j = 0; j <
ny; j++ )
3090 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
3092 else if ( wrap == 1 )
3102 for ( i = 0; i <
nx; i++ )
3103 for ( j = 0; j <
ny; j++ )
3104 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
3107 for ( i = 0; i <
nx; i++ )
3109 for ( j = 0; j <
ny; j++ )
3111 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
3112 zwrapped[i][j] = z[i][j];
3116 for ( j = 0; j <
ny; j++ )
3118 cgrid2.
xg[
nx][j] = cgrid2.
xg[0][j];
3119 cgrid2.
yg[
nx][j] = cgrid2.
yg[0][j];
3120 zwrapped[
nx][j] = zwrapped[0][j];
3129 else if ( wrap == 2 )
3139 for ( i = 0; i <
nx; i++ )
3140 for ( j = 0; j <
ny; j++ )
3141 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
3144 for ( i = 0; i <
nx; i++ )
3146 for ( j = 0; j <
ny; j++ )
3148 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
3149 zwrapped[i][j] = z[i][j];
3153 for ( i = 0; i <
nx; i++ )
3155 cgrid2.
xg[i][
ny] = cgrid2.
xg[i][0];
3156 cgrid2.
yg[i][
ny] = cgrid2.
yg[i][0];
3157 zwrapped[i][
ny] = zwrapped[i][0];
3168 Tcl_SetResult( interp,
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
3173 pltr_data = &cgrid2;
3177 Tcl_AppendResult( interp,
3178 "Unrecognized coordinate transformation spec:",
3179 pltrname,
", must be NULL, pltr0, pltr1, or pltr2.",
3186 plshades( (
const PLFLT *
const *) zused, nx, ny, NULL,
3187 xmin, xmax, ymin, ymax,
3234 cmd = (
char *) malloc( strlen( transform_name ) + 40 );
3237 sprintf( cmd,
"matrix %cx f %d", (
char) 1, n );
3238 if ( Tcl_Eval( tcl_interp, cmd ) != TCL_OK )
3240 return_code = TCL_ERROR;
3244 sprintf( cmd,
"matrix %cy f %d", (
char) 1, n );
3245 if ( Tcl_Eval( tcl_interp, cmd ) != TCL_OK )
3247 return_code = TCL_ERROR;
3252 sprintf( cmd,
"%cx", (
char) 1 );
3254 sprintf( cmd,
"%cy", (
char) 1 );
3257 if ( xPtr == NULL || yPtr == NULL )
3260 for ( i = 0; i < n; i++ )
3262 xPtr->
fdata[i] = x[i];
3263 yPtr->
fdata[i] = y[i];
3267 sprintf( cmd,
"%s %d %cx %cy", transform_name, n, (
char) 1, (
char) 1 );
3268 return_code = Tcl_Eval( tcl_interp, cmd );
3269 if ( return_code != TCL_OK )
3277 for ( i = 0; i < n; i++ )
3279 x[i] = xPtr->
fdata[i];
3280 y[i] = yPtr->
fdata[i];
3286 sprintf( cmd,
"rename %cx {}; rename %cy {}", (
char) 1, (
char) 1 );
3287 return_code = Tcl_Eval( tcl_interp, cmd );
3306 PLFLT minlong, maxlong, minlat, maxlat;
3310 return_code = TCL_OK;
3311 if ( argc < 6 || argc > 7 )
3313 Tcl_AppendResult( interp,
"bogus syntax for plmap, see doc.",
3322 transform_name = NULL;
3323 minlong = atof( argv[2] );
3324 maxlong = atof( argv[3] );
3325 minlat = atof( argv[4] );
3326 maxlat = atof( argv[5] );
3332 minlong = atof( argv[3] );
3333 maxlong = atof( argv[4] );
3334 minlat = atof( argv[5] );
3335 maxlat = atof( argv[6] );
3338 transform_name = argv[1];
3339 if ( strlen( transform_name ) == 0 )
3345 if ( transform && idxname == 2 )
3347 plmap( &
mapform, argv[idxname], minlong, maxlong, minlat, maxlat );
3352 plmap( NULL, argv[idxname], minlong, maxlong, minlat, maxlat );
3373 PLFLT dlong, dlat, minlong, maxlong, minlat, maxlat;
3376 return_code = TCL_OK;
3378 if ( argc < 7 || argc > 8 )
3380 Tcl_AppendResult( interp,
"bogus syntax for plmeridians, see doc.",
3388 transform_name = NULL;
3389 dlong = atof( argv[1] );
3390 dlat = atof( argv[2] );
3391 minlong = atof( argv[3] );
3392 maxlong = atof( argv[4] );
3393 minlat = atof( argv[5] );
3394 maxlat = atof( argv[6] );
3398 dlong = atof( argv[2] );
3399 dlat = atof( argv[3] );
3400 minlong = atof( argv[4] );
3401 maxlong = atof( argv[5] );
3402 minlat = atof( argv[6] );
3403 maxlat = atof( argv[7] );
3407 transform_name = argv[1];
3408 if ( strlen( transform_name ) == 0 )
3420 plmeridians( NULL, dlong, dlat, minlong, maxlong, minlat, maxlat );
3430 #if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 5
3431 "set result [%s ${_##_x} ${_##_y}] ; set _##_x [lindex $result 0] ; set _##_y [lindex $result 1]"
3433 "set result [%s ${_##_x} ${_##_y}] ; lassign $result _##_x _##_y"
3442 Tcl_Obj *objx, *objy;
3447 objx = Tcl_NewDoubleObj( x );
3448 Tcl_IncrRefCount( objx );
3449 Tcl_SetVar2Ex( tcl_xform_interp,
3450 "_##_x", NULL, objx, 0 );
3451 Tcl_DecrRefCount( objx );
3454 objy = Tcl_NewDoubleObj( y );
3455 Tcl_IncrRefCount( objy );
3456 Tcl_SetVar2Ex( tcl_xform_interp,
3457 "_##_y", NULL, objy, 0 );
3458 Tcl_DecrRefCount( objy );
3467 code = Tcl_Eval( tcl_xform_interp, tcl_xform_code );
3469 if ( code != TCL_OK )
3471 printf(
"Unable to evaluate Tcl-side coordinate transform.\n" );
3472 printf(
"code = %d\n", code );
3473 printf(
"Error result: %s\n", Tcl_GetStringResult( tcl_xform_interp ) );
3477 objx = Tcl_GetVar2Ex( tcl_xform_interp,
"_##_x", NULL, 0 );
3478 objy = Tcl_GetVar2Ex( tcl_xform_interp,
"_##_y", NULL, 0 );
3482 if ( Tcl_GetDoubleFromObj( tcl_xform_interp, objx, &dx ) != TCL_OK ||
3483 Tcl_GetDoubleFromObj( tcl_xform_interp, objy, &dy ) != TCL_OK )
3485 printf(
"Unable to extract Tcl results.\n" );
3504 || strcmp( argv[1],
"NULL" ) == 0 )
3508 tcl_xform_interp = 0;
3509 if ( tcl_xform_procname )
3511 free( tcl_xform_procname );
3512 tcl_xform_procname = 0;
3519 tcl_xform_interp =
interp;
3520 tcl_xform_procname =
plstrdup( argv[1] );
3522 len = strlen( tcl_xform_template ) + strlen( tcl_xform_procname );
3523 tcl_xform_code = malloc( len );
3524 sprintf( tcl_xform_code, tcl_xform_template, tcl_xform_procname );
3541 tclMatrix *arrx, *arry, *arrz, *xcoord, *ycoord, *zvalue;
3551 Tcl_AppendResult( interp,
"wrong # args: see documentation for ",
3552 argv[0], (
char *) NULL );
3565 sscanf( argv[7],
"%d", &alg );
3567 sscanf( argv[8],
"%lg", &value ); optalg = (
PLFLT) value;
3569 if ( arrx == NULL || arrx->
dim != 1 )
3571 Tcl_AppendResult( interp, argv[0],
": argument 1 should be a \
3572 one-dimensional matrix - ", argv[1], (
char *) NULL );
3575 if ( arry == NULL || arry->
dim != 1 )
3577 Tcl_AppendResult( interp, argv[0],
": argument 2 should be a \
3578 one-dimensional matrix - ", argv[2], (
char *) NULL );
3581 if ( arrz == NULL || arrz->
dim != 1 )
3583 Tcl_AppendResult( interp, argv[0],
": argument 3 should be a \
3584 one-dimensional matrix - ", argv[3], (
char *) NULL );
3588 if ( xcoord == NULL || xcoord->
dim != 1 )
3590 Tcl_AppendResult( interp, argv[0],
": argument 4 should be a \
3591 one-dimensional matrix - ", argv[4], (
char *) NULL );
3594 if ( ycoord == NULL || ycoord->
dim != 1 )
3596 Tcl_AppendResult( interp, argv[0],
": argument 5 should be a \
3597 one-dimensional matrix - ", argv[5], (
char *) NULL );
3600 if ( zvalue == NULL || zvalue->
dim != 2 )
3602 Tcl_AppendResult( interp, argv[0],
": argument 6 should be a \
3603 two-dimensional matrix - ", argv[6], (
char *) NULL );
3617 xcoord->
fdata, nx, ycoord->
fdata, ny, z, alg, optalg );
3620 for ( i = 0; i <
nx; i++ )
3622 for ( j = 0; j <
ny; j++ )
3624 zvalue->
fdata[j + zvalue->
n[1] * i] = z[i][j];
3651 Tcl_AppendResult( interp,
"wrong # args: see documentation for ",
3652 argv[0], (
char *) NULL );
3658 if ( zvalue == NULL || zvalue->
dim != 2 )
3660 Tcl_AppendResult( interp, argv[0],
": argument 1 should be a \
3661 two-dimensional matrix - ", argv[1], (
char *) NULL );
3665 sscanf( argv[2],
"%lg", &value ); xmin = (
PLFLT) value;
3666 sscanf( argv[3],
"%lg", &value ); xmax = (
PLFLT) value;
3667 sscanf( argv[4],
"%lg", &value ); ymin = (
PLFLT) value;
3668 sscanf( argv[5],
"%lg", &value ); ymax = (
PLFLT) value;
3669 sscanf( argv[6],
"%lg", &value ); zmin = (
PLFLT) value;
3670 sscanf( argv[7],
"%lg", &value ); zmax = (
PLFLT) value;
3671 sscanf( argv[8],
"%lg", &value ); Dxmin = (
PLFLT) value;
3672 sscanf( argv[9],
"%lg", &value ); Dxmax = (
PLFLT) value;
3673 sscanf( argv[10],
"%lg", &value ); Dymin = (
PLFLT) value;
3674 sscanf( argv[11],
"%lg", &value ); Dymax = (
PLFLT) value;
3681 for ( i = 0; i <
nx; i++ )
3683 for ( j = 0; j <
ny; j++ )
3685 pidata[i][j] = zvalue->
fdata[j + i *
ny];
3697 c_plimage( (
const PLFLT *
const *) pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
3698 Dxmin, Dxmax, Dymin, Dymax );
3728 if ( argc != 12 && argc != 10 )
3730 Tcl_AppendResult( interp,
"wrong # args: see documentation for ",
3731 argv[0], (
char *) NULL );
3737 if ( zvalue == NULL || zvalue->
dim != 2 )
3739 Tcl_AppendResult( interp, argv[0],
": argument 1 should be a \
3740 two-dimensional matrix - ", argv[1], (
char *) NULL );
3751 if ( xg == NULL || xg->
dim != 2 )
3753 Tcl_AppendResult( interp, argv[0],
": argument 10 should be a \
3754 two-dimensional matrix - ", argv[10], (
char *) NULL );
3758 if ( yg == NULL || yg->
dim != 2 )
3760 Tcl_AppendResult( interp, argv[0],
": argument 11 should be a \
3761 two-dimensional matrix - ", argv[11], (
char *) NULL );
3766 sscanf( argv[2],
"%lg", &value ); xmin = (
PLFLT) value;
3767 sscanf( argv[3],
"%lg", &value ); xmax = (
PLFLT) value;
3768 sscanf( argv[4],
"%lg", &value ); ymin = (
PLFLT) value;
3769 sscanf( argv[5],
"%lg", &value ); ymax = (
PLFLT) value;
3770 sscanf( argv[6],
"%lg", &value ); zmin = (
PLFLT) value;
3771 sscanf( argv[7],
"%lg", &value ); zmax = (
PLFLT) value;
3772 sscanf( argv[8],
"%lg", &value ); valuemin = (
PLFLT) value;
3773 sscanf( argv[9],
"%lg", &value ); valuemax = (
PLFLT) value;
3780 for ( i = 0; i <
nx; i++ )
3782 for ( j = 0; j <
ny; j++ )
3784 pidata[i][j] = zvalue->
fdata[j + i *
ny];
3795 for ( i = 0; i <=
nx; i++ )
3797 for ( j = 0; j <=
ny; j++ )
3799 cgrid2.
xg[i][j] = xg->
fdata[j + i * ( ny + 1 )];
3800 cgrid2.
yg[i][j] = yg->
fdata[j + i * ( ny + 1 )];
3803 c_plimagefr( (
const PLFLT *
const *) pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
3804 valuemin, valuemax,
pltr2, (
void *) &cgrid2 );
3808 c_plimagefr( (
const PLFLT *
const *) pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
3809 valuemin, valuemax,
pltr0, NULL );
3842 PLINT colbox, collab;
3843 PLINT colline[4], styline[4];
3845 const char **legline;
3853 Tcl_AppendResult( interp,
"wrong # args: see documentation for ",
3854 argv[0], (
char *) NULL );
3861 if ( colMat == NULL || colMat->
dim != 1 || colMat->
idata == NULL )
3863 Tcl_AppendResult( interp, argv[0],
": argument 15 should be a \
3864 one-dimensional integer matrix - ", argv[15], (
char *) NULL );
3868 if ( styleMat == NULL || styleMat->
dim != 1 || styleMat->
idata == NULL )
3870 Tcl_AppendResult( interp, argv[0],
": argument 16 should be a \
3871 one-dimensional integer matrix - ", argv[16], (
char *) NULL );
3879 sscanf( argv[4],
"%lg", &value ); xmin = (
PLFLT) value;
3880 sscanf( argv[5],
"%lg", &value ); xmax = (
PLFLT) value;
3881 sscanf( argv[6],
"%lg", &value ); xjump = (
PLFLT) value;
3882 sscanf( argv[7],
"%lg", &value ); ymin = (
PLFLT) value;
3883 sscanf( argv[8],
"%lg", &value ); ymax = (
PLFLT) value;
3884 sscanf( argv[9],
"%lg", &value ); xlpos = (
PLFLT) value;
3885 sscanf( argv[10],
"%lg", &value ); ylpos = (
PLFLT) value;
3886 sscanf( argv[11],
"%d", &ivalue ); y_ascl = (
PLBOOL) ivalue;
3887 sscanf( argv[12],
"%d", &ivalue ); acc = (
PLBOOL) ivalue;
3888 sscanf( argv[13],
"%d", &ivalue ); colbox = ivalue;
3889 sscanf( argv[14],
"%d", &ivalue ); collab = ivalue;
3895 for ( i = 0; i < 4; i++ )
3897 colline[i] = colMat->
idata[i];
3898 styline[i] = styleMat->
idata[i];
3901 if ( Tcl_SplitList( interp, argv[17], &nlegend, &legline ) != TCL_OK )
3907 Tcl_AppendResult( interp, argv[0],
": argument 18 should be a \
3908 list of at least four items - ", argv[17], (
char *) NULL );
3913 xmin, xmax, xjump, ymin, ymax,
3917 colline, styline, legline,
3918 labx, laby, labtop );
3920 sprintf( idvalue,
"%d",
id );
3921 Tcl_SetVar( interp, idName, idvalue, 0 );
3923 Tcl_Free( (
char *) legline );
3942 label_objs[1] = Tcl_NewIntObj( axis );
3943 label_objs[2] = Tcl_NewDoubleObj( (
double) value );
3945 Tcl_IncrRefCount( label_objs[1] );
3946 Tcl_IncrRefCount( label_objs[2] );
3950 if ( label_objs[3] != NULL )
3955 return_code = Tcl_EvalObjv( tcl_interp, objc, label_objs, 0 );
3957 if ( return_code != TCL_OK )
3959 strncpy(
string,
"ERROR", (
size_t) string_length );
3963 strncpy(
string, Tcl_GetStringResult( tcl_interp ), (
size_t) string_length );
3966 Tcl_DecrRefCount( label_objs[1] );
3967 Tcl_DecrRefCount( label_objs[2] );
3983 if ( argc < 2 || argc > 3 )
3985 Tcl_AppendResult( interp,
"bogus syntax for plslabelfunc, see doc.",
3992 if ( label_objs[0] != NULL )
3994 Tcl_DecrRefCount( label_objs[0] );
3996 if ( label_objs[3] != NULL )
3998 Tcl_DecrRefCount( label_objs[3] );
3999 label_objs[3] = NULL;
4002 if ( strlen( argv[1] ) == 0 )
4010 label_objs[0] = Tcl_NewStringObj( argv[1], (
int) strlen( argv[1] ) );
4011 Tcl_IncrRefCount( label_objs[0] );
4016 label_objs[3] = Tcl_NewStringObj( argv[2], (
int) strlen( argv[2] ) );
4017 Tcl_IncrRefCount( label_objs[3] );
4021 label_objs[3] = NULL;
4036 static int *
argv_to_ints( Tcl_Interp *interp,
const char *list_numbers,
int *number )
4043 list = Tcl_NewStringObj( list_numbers, ( -1 ) );
4045 retcode = Tcl_ListObjLength( interp, list, number );
4046 if ( retcode != TCL_OK || ( *number ) == 0 )
4053 array = (
int *) malloc(
sizeof (
int ) * (size_t) ( *number ) );
4054 for ( i = 0; i < ( *number ); i++ )
4056 Tcl_ListObjIndex( interp, list, i, &elem );
4057 Tcl_GetIntFromObj( interp, elem, &array[i] );
4063 static double *
argv_to_doubles( Tcl_Interp *interp,
const char *list_numbers,
int *number )
4070 list = Tcl_NewStringObj( list_numbers, ( -1 ) );
4072 retcode = Tcl_ListObjLength( interp, list, number );
4073 if ( retcode != TCL_OK || ( *number ) == 0 )
4080 array = (
double *) malloc(
sizeof (
double ) * (size_t) ( *number ) );
4081 for ( i = 0; i < ( *number ); i++ )
4083 Tcl_ListObjIndex( interp, list, i, &elem );
4084 Tcl_GetDoubleFromObj( interp, elem, &array[i] );
4090 static char **
argv_to_chars( Tcl_Interp *interp,
const char *list_strings,
int *number )
4100 list = Tcl_NewStringObj( list_strings, ( -1 ) );
4102 retcode = Tcl_ListObjLength( interp, list, number );
4103 if ( retcode != TCL_OK || ( *number ) == 0 )
4110 array = (
char **) malloc(
sizeof (
char* ) * (size_t) ( *number ) );
4111 array[0] = (
char *) malloc(
sizeof (
char ) * ( strlen( list_strings ) + 1 ) );
4113 for ( i = 0; i < ( *number ); i++ )
4115 Tcl_ListObjIndex( interp, list, i, &elem );
4116 string = Tcl_GetStringFromObj( elem, &length );
4118 array[i] = array[0] + idx;
4119 strncpy( array[i],
string, (
size_t) length );
4121 array[0][idx - 1] =
'\0';
4131 PLFLT legend_width, legend_height;
4135 PLINT nrow, ncolumn;
4138 PLFLT text_offset, text_scale, text_spacing, text_justification;
4140 PLINT *box_colors, *box_patterns;
4142 PLINT *line_colors, *line_styles;
4143 PLFLT *box_line_widths, *line_widths;
4144 PLINT *symbol_colors, *symbol_numbers;
4145 PLFLT *symbol_scales;
4158 Tcl_AppendResult( interp,
"bogus syntax for pllegend, see doc.",
4163 sscanf( argv[1],
"%d", &opt );
4164 sscanf( argv[2],
"%d", &position );
4165 sscanf( argv[3],
"%lg", &value ); x = (
PLFLT) value;
4166 sscanf( argv[4],
"%lg", &value ); y = (
PLFLT) value;
4167 sscanf( argv[5],
"%lg", &value ); plot_width = (
PLFLT) value;
4168 sscanf( argv[6],
"%d", &bg_color );
4169 sscanf( argv[7],
"%d", &bb_color );
4170 sscanf( argv[8],
"%d", &bb_style );
4171 sscanf( argv[9],
"%d", &nrow );
4172 sscanf( argv[10],
"%d", &ncolumn );
4173 opt_array =
argv_to_ints( interp, argv[11], &number_opts );
4174 sscanf( argv[12],
"%lg", &value ); text_offset = (
PLFLT) value;
4175 sscanf( argv[13],
"%lg", &value ); text_scale = (
PLFLT) value;
4176 sscanf( argv[14],
"%lg", &value ); text_spacing = (
PLFLT) value;
4177 sscanf( argv[15],
"%lg", &value ); text_justification = (
PLFLT) value;
4179 text_colors =
argv_to_ints( interp, argv[16], &dummy );
4182 box_patterns =
argv_to_ints( interp, argv[19], &dummy );
4185 line_colors =
argv_to_ints( interp, argv[22], &dummy );
4186 line_styles =
argv_to_ints( interp, argv[23], &dummy );
4188 symbol_colors =
argv_to_ints( interp, argv[25], &dummy );
4190 symbol_numbers =
argv_to_ints( interp, argv[27], &dummy );
4193 nlegend =
MIN( number_opts, number_texts );
4196 opt, position, x, y, plot_width,
4197 bg_color, bb_color, bb_style,
4200 text_offset, text_scale, text_spacing,
4202 text_colors, (
const char *
const *) text,
4203 box_colors, box_patterns,
4204 box_scales, box_line_widths,
4205 line_colors, line_styles,
4207 symbol_colors, symbol_scales,
4208 symbol_numbers, (
const char *
const *) symbols );
4210 if ( opt_array != NULL )
4212 if ( text_colors != NULL )
4213 free( text_colors );
4219 if ( box_colors != NULL )
4221 if ( box_patterns != NULL )
4222 free( box_patterns );
4223 if ( box_scales != NULL )
4225 if ( box_line_widths != NULL )
4226 free( box_line_widths );
4227 if ( line_colors != NULL )
4228 free( line_colors );
4229 if ( line_styles != NULL )
4230 free( line_styles );
4231 if ( line_widths != NULL )
4232 free( line_widths );
4233 if ( symbol_colors != NULL )
4234 free( symbol_colors );
4235 if ( symbol_scales != NULL )
4236 free( symbol_scales );
4237 if ( symbol_numbers != NULL )
4238 free( symbol_numbers );
4239 if ( symbols != NULL )
4245 data[0] = Tcl_NewDoubleObj( legend_width );
4246 data[1] = Tcl_NewDoubleObj( legend_height );
4247 Tcl_SetObjResult( interp, Tcl_NewListObj( 2, data ) );
4262 PLFLT colorbar_width, colorbar_height;
4280 Tcl_Obj *list_vectors;
4282 PLINT *vector_sizes;
4283 PLFLT **vector_values;
4296 Tcl_AppendResult( interp,
"bogus syntax for plcolorbar, see doc.",
4302 sscanf( argv[1],
"%d", &opt );
4303 sscanf( argv[2],
"%d", &position );
4304 sscanf( argv[3],
"%lg", &value ); x = (
PLFLT) value;
4305 sscanf( argv[4],
"%lg", &value ); y = (
PLFLT) value;
4306 sscanf( argv[5],
"%lg", &value ); x_length = (
PLFLT) value;
4307 sscanf( argv[6],
"%lg", &value ); y_length = (
PLFLT) value;
4308 sscanf( argv[7],
"%d", &bg_color );
4309 sscanf( argv[8],
"%d", &bb_color );
4310 sscanf( argv[9],
"%d", &bb_style );
4311 sscanf( argv[10],
"%lg", &value ); low_cap_color = (
PLFLT) value;
4312 sscanf( argv[11],
"%lg", &value ); high_cap_color = (
PLFLT) value;
4313 sscanf( argv[12],
"%d", &cont_color );
4314 sscanf( argv[13],
"%lg", &value ); cont_width = (
PLFLT) value;
4315 label_opts =
argv_to_ints( interp, argv[14], &n_label_opts );
4317 axis_opts =
argv_to_chars( interp, argv[16], &n_axis_opts );
4319 sub_ticks =
argv_to_ints( interp, argv[18], &n_sub_ticks );
4320 list_vectors = Tcl_NewStringObj( argv[19], ( -1 ) );
4323 if ( n_label_opts != n_labels )
4325 Tcl_AppendResult( interp,
"number of label options must equal number of labels.",
4329 if ( n_axis_opts != n_ticks || n_axis_opts != n_sub_ticks )
4331 Tcl_AppendResult( interp,
"number of axis, tick and subtick options must be equal.",
4335 n_axes = n_axis_opts;
4337 retcode = Tcl_ListObjLength( interp, list_vectors, &n_vectors );
4338 if ( retcode != TCL_OK || n_vectors == 0 )
4340 Tcl_AppendResult( interp,
"malformed list of vectors or no vector at all.",
4346 vector_sizes = (
int *) malloc(
sizeof (
int ) * (size_t) n_vectors );
4347 vector_values = (
PLFLT **) malloc(
sizeof (
PLFLT * ) * (size_t) n_vectors );
4348 for ( i = 0; i < n_vectors; i++ )
4350 Tcl_ListObjIndex( interp, list_vectors, i, &vector );
4351 vectorPtr =
Tcl_GetMatrixPtr( interp, Tcl_GetStringFromObj( vector, &length ) );
4352 if ( vectorPtr == NULL || vectorPtr->
dim != 1 )
4354 Tcl_AppendResult( interp,
"element in list of vectors is not a vector.",
4358 vector_sizes[i] = vectorPtr->
n[0];
4359 vector_values[i] = vectorPtr->
fdata;
4364 opt, position, x, y,
4366 bg_color, bb_color, bb_style,
4367 low_cap_color, high_cap_color,
4368 cont_color, cont_width,
4369 n_labels, label_opts, (
const char *
const *) labels,
4370 n_axes, (
const char *
const *) axis_opts,
4372 vector_sizes, (
const PLFLT *
const *) vector_values );
4374 if ( label_opts != NULL )
4376 if ( labels != NULL )
4381 if ( axis_opts != NULL )
4383 free( axis_opts[0] );
4386 if ( ticks != NULL )
4388 if ( sub_ticks != NULL )
4390 if ( vector_values != NULL )
4392 free( vector_sizes );
4393 free( vector_values );
4396 Tcl_DecrRefCount( list_vectors );
4398 data[0] = Tcl_NewDoubleObj( colorbar_width );
4399 data[1] = Tcl_NewDoubleObj( colorbar_height );
4400 Tcl_SetObjResult( interp, Tcl_NewListObj( 2, data ) );
int Pltcl_Init(Tcl_Interp *interp)
static int plslabelfuncCmd(ClientData, Tcl_Interp *, int, const char **)
void plFree2dGrid(PLFLT **f, PLINT nx, PLINT PL_UNUSED(ny))
static double * argv_to_doubles(Tcl_Interp *interp, const char *list_numbers, int *number)
def cmd
Now do the PLplot API.
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT nx
void plGetName(const char *dir, const char *subdir, const char *filename, char **filespec)
PLDLLIMPORT char * plplotLibDir
void mapform(PLINT n, PLFLT *x, PLFLT *y)
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT bb_color
void PLFLT PLINT PLINT position
void plgriddata(PLFLT *x, PLFLT *y, PLFLT *z, int npts, PLFLT *xg, int nptsx, PLFLT *yg, int nptsy, PLFLT **zg, int type, PLFLT data)
tclMatrix * Tcl_GetMatrixPtr(Tcl_Interp *interp, const char *matName)
static int plcontCmd(ClientData, Tcl_Interp *, int, const char **)
static int cmdTable_initted
static int plmapCmd(ClientData, Tcl_Interp *, int, const char **)
static char ** argv_to_chars(Tcl_Interp *interp, const char *list_strings, int *number)
static char * tcl_xform_procname
void PLFLT PLINT PLINT PLFLT x
void plAlloc2dGrid(PLFLT ***f, PLINT nx, PLINT ny)
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT const char *const * axis_opts
void plsError(PLINT *errcode, char *errmsg)
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, const PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLFLT text_justification, const PLINT *text_colors, const char *const *text, const PLINT *box_colors, const PLINT *box_patterns, const PLFLT *box_scales, const PLFLT *box_line_widths, const PLINT *line_colors, const PLINT *line_styles, const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers, const char *const *symbols)
static int plstripcCmd(ClientData, Tcl_Interp *, int, const char **)
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT low_cap_color
static int tclmateval_modx
void c_plimagefr(const PLFLT *const *idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, void(*pltr)(PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), PLPointer pltr_data)
static int plot3dcCmd(ClientData, Tcl_Interp *, int, const char **)
int(* proc)(void *, struct 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 void pltr(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data)
static void Tcl_transform(PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer PL_UNUSED(data))
void PLFLT PLINT PLINT PLFLT PLFLT y
static int plsurf3dCmd(ClientData, Tcl_Interp *, int, const char **)
void c_plimage(const PLFLT *const *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)
static int plgriddataCmd(ClientData, Tcl_Interp *, int, const char **)
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
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT high_cap_color
static int plmeshCmd(ClientData, Tcl_Interp *, int, const char **)
static Tcl_Obj * label_objs[4]
static int plimageCmd(ClientData, Tcl_Interp *, int, const char **)
subroutine plsetopt(opt, optarg)
static int plmeridiansCmd(ClientData, Tcl_Interp *, int, const char **)
static const char * tcl_xform_template
char PLDLLIMPEXP * plstrdup(const char *src)
static int plshadeCmd(ClientData, Tcl_Interp *, int, const char **)
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT cont_color
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)
static PLFLT value(double n1, double n2, double hue)
int(* proc)(void *, struct Tcl_Interp *, int, const char **)
PLFLT tclMatrix_feval(PLINT i, PLINT j, PLPointer p)
static int tclmateval_mody
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT x_length
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 PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT cont_width
static int plsetoptCmd(ClientData, Tcl_Interp *, int, const char **)
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT bb_style
static const char * transform_name
static Tcl_HashTable cmdTable
void c_plstripc(PLINT *id, const char *xspec, const char *yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLINT y_ascl, PLINT acc, PLINT colbox, PLINT collab, const PLINT *colline, const PLINT *styline, const char *legline[], const char *labx, const char *laby, const char *labtop)
static Tcl_Interp * interp
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT bg_color
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT * label_opts
static int plcolorbarCmd(ClientData, Tcl_Interp *, int, const char **)
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT const char *const const PLFLT const PLINT * sub_ticks
static int pllegendCmd(ClientData, Tcl_Interp *, int, const char **)
dx
if { $zoomopts($this,1) == 0 } then {
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT const PLINT const char *const PLINT const char *const const PLFLT * ticks
static int plstransformCmd(ClientData, Tcl_Interp *, int, const char **)
static int plmeshcCmd(ClientData, Tcl_Interp *, int, const char **)
PLDLLIMPEXP int plInBuildTree()
static void Append_Cmdlist(Tcl_Interp *interp)
static Tcl_Interp * tcl_xform_interp
static void plTclCmd_Init(Tcl_Interp *PL_UNUSED(interp))
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, const PLINT *label_opts, const char *const *labels, PLINT n_axes, const char *const *axis_opts, const PLFLT *ticks, const PLINT *sub_ticks, const PLINT *n_values, const PLFLT *const *values)
static int plranddCmd(ClientData, Tcl_Interp *, int, const char **)
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT y_length
void PLFLT PLINT PLINT PLFLT PLFLT PLFLT PLFLT PLINT PLINT PLINT PLFLT PLFLT PLINT PLFLT PLINT n_labels