38#ifdef PL_HAVE_UNISTD_H
50#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
59#undef PLPLOTTCLTK_NON_REDACTED_API
62#define CHECK_Tcl_GetMatrixPtr( result, interp, matName ) \
63 result = Tcl_GetMatrixPtr( interp, matName ); \
64 if ( result == NULL ) return TCL_ERROR;
68static int loopbackCmd( ClientData, Tcl_Interp *,
int,
const char ** );
69static int plcolorbarCmd( ClientData, Tcl_Interp *,
int,
const char ** );
70static int plcontCmd( ClientData, Tcl_Interp *,
int,
const char ** );
71static int pllegendCmd( ClientData, Tcl_Interp *,
int,
const char ** );
72static int plmeshCmd( ClientData, Tcl_Interp *,
int,
const char ** );
73static int plmeshcCmd( ClientData, Tcl_Interp *,
int,
const char ** );
74static int plot3dCmd( ClientData, Tcl_Interp *,
int,
const char ** );
75static int plot3dcCmd( ClientData, Tcl_Interp *,
int,
const char ** );
76static int plsurf3dCmd( ClientData, Tcl_Interp *,
int,
const char ** );
77static int plsurf3dlCmd( ClientData, Tcl_Interp *,
int,
const char ** );
78static int plsetoptCmd( ClientData, Tcl_Interp *,
int,
const char ** );
79static int plshadeCmd( ClientData, Tcl_Interp *,
int,
const char ** );
80static int plshadesCmd( ClientData, Tcl_Interp *,
int,
const char ** );
81static int plmapCmd( ClientData, Tcl_Interp *,
int,
const char ** );
82static int plmapfillCmd( ClientData, Tcl_Interp *,
int,
const char ** );
83static int plmaplineCmd( ClientData, Tcl_Interp *,
int,
const char ** );
85static int plmaptexCmd( ClientData, Tcl_Interp *,
int,
const char ** );
88static int plsvectCmd( ClientData, Tcl_Interp *,
int,
const char ** );
89static int plvectCmd( ClientData, Tcl_Interp *,
int,
const char ** );
90static int plranddCmd( ClientData, Tcl_Interp *,
int,
const char ** );
91static int plgriddataCmd( ClientData, Tcl_Interp *,
int,
const char ** );
92static int plimageCmd( ClientData, Tcl_Interp *,
int,
const char ** );
93static int plimagefrCmd( ClientData, Tcl_Interp *,
int,
const char ** );
94static int plstripcCmd( ClientData, Tcl_Interp *,
int,
const char ** );
107 int ( *
proc )(
void *,
struct Tcl_Interp *, int,
const char ** );
118 int ( *
proc )(
void *,
struct Tcl_Interp *, int,
const char ** );
174#if ( !defined ( MAC_TCL ) && !defined ( _WIN32 ) )
180#define PLPLOT_EXTENDED_SEARCH
199 static int inited = 0;
200 static const char** namelist;
201 int i, j, ncmds =
sizeof (
Cmds ) /
sizeof (
CmdInfo );
205 namelist = (
const char **) malloc( (
size_t) ncmds *
sizeof (
char * ) );
207 for ( i = 0; i < ncmds; i++ )
212 for ( i = 0; i < ncmds - 1; i++ )
213 for ( j = i + 1; j < ncmds - 1; j++ )
215 if ( strcmp( namelist[i], namelist[j] ) > 0 )
217 const char *t = namelist[i];
218 namelist[i] = namelist[j];
226 for ( i = 0; i < ncmds; i++ )
227 Tcl_AppendResult(
interp,
" ", namelist[i], (
char *) NULL );
251 Tcl_InitHashTable( &
cmdTable, TCL_STRING_KEYS );
255 for ( cmdInfoPtr =
Cmds; cmdInfoPtr->
name != NULL; cmdInfoPtr++ )
260 hPtr = Tcl_CreateHashEntry( &
cmdTable, cmdInfoPtr->
name, &
new );
268 Tcl_SetHashValue( hPtr, cmdPtr );
297 register Tcl_HashEntry *hPtr;
314 Tcl_AppendResult(
interp, cmdlist, (
char *) NULL );
324 Tcl_AppendResult(
interp,
"bad option \"",
argv[0],
325 "\" to \"cmd\": must be one of ",
326 cmdlist, (
char *) NULL );
334 if ( result == TCL_OK )
365 register Tcl_HashEntry *hPtr;
369 if (
argc == 0 || ( strcmp(
argv[0],
"cmd" ) != 0 ) )
371 Tcl_AppendResult(
interp,
"bad option \"",
argv[0],
372 "\" to \"loopback\": must be ",
373 "\"cmd ?options?\" ", (
char *) NULL );
399 Tcl_AppendResult(
interp,
"bad option \"",
argv[0],
400 "\" to \"loopback cmd\": must be one of ",
426 int debug = plsc->debug;
427 const char *libDir = NULL;
428 static char initScript[] =
429 "tcl_findLibrary plplot " PLPLOT_VERSION " \"\" plplot.tcl PL_LIBRARY pllibrary";
430#ifdef PLPLOT_EXTENDED_SEARCH
431 static char initScriptExtended[] =
432 "tcl_findLibrary plplot " PLPLOT_VERSION "/tcl \"\" plplot.tcl PL_LIBRARY pllibrary";
442 Tcl_InitStubs(
interp,
"8.1", 0 );
449 fprintf( stderr,
"error in matrix init\n" );
460#ifdef USE_MATRIX_STUBS
461 if ( Matrix_InitStubs(
interp,
"0.1", 0 ) == NULL )
464 fprintf( stderr,
"error in matrix stubs init\n" );
468 Tcl_PkgRequire(
interp,
"Matrix",
"0.1", 0 );
475 Tcl_SetVar(
interp,
"pl_itcl_package_name",
"Itcl 4", TCL_GLOBAL_ONLY );
477 Tcl_SetVar(
interp,
"pl_itcl_package_name",
"Itcl 3", TCL_GLOBAL_ONLY );
482 Tcl_SetVar(
interp,
"pl_itcl_package_name",
"Itcl(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY );
485 Tcl_SetVar(
interp,
"pl_itk_package_name",
"Itk 4", TCL_GLOBAL_ONLY );
487 Tcl_SetVar(
interp,
"pl_itk_package_name",
"Itk 3", TCL_GLOBAL_ONLY );
492 Tcl_SetVar(
interp,
"pl_itk_package_name",
"Itk(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY );
495 Tcl_SetVar(
interp,
"pl_iwidgets_package_name",
"Iwidgets 4", TCL_GLOBAL_ONLY );
502 Tcl_SetVar(
interp,
"pl_iwidgets_package_name",
"Iwidgets(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY );
513 fprintf( stderr,
"trying BUILD_DIR\n" );
515 Tcl_SetVar(
interp,
"pllibrary", libDir, TCL_GLOBAL_ONLY );
516 if ( Tcl_Eval(
interp, initScript ) != TCL_OK )
519 Tcl_UnsetVar(
interp,
"pllibrary", TCL_GLOBAL_ONLY );
520 Tcl_ResetResult(
interp );
525 if ( libDir == NULL )
528 fprintf( stderr,
"trying init script\n" );
529 if ( Tcl_Eval(
interp, initScript ) != TCL_OK )
532 Tcl_UnsetVar(
interp,
"pllibrary", TCL_GLOBAL_ONLY );
534 Tcl_ResetResult(
interp );
537 libDir = Tcl_GetVar(
interp,
"pllibrary", TCL_GLOBAL_ONLY );
542 if ( libDir == NULL )
545 fprintf( stderr,
"trying TCL_DIR\n" );
547 Tcl_SetVar(
interp,
"pllibrary", libDir, TCL_GLOBAL_ONLY );
548 if ( Tcl_Eval(
interp, initScript ) != TCL_OK )
551 Tcl_UnsetVar(
interp,
"pllibrary", TCL_GLOBAL_ONLY );
552 Tcl_ResetResult(
interp );
557#ifdef PLPLOT_EXTENDED_SEARCH
559 if ( libDir == NULL )
562 fprintf( stderr,
"trying extended init script\n" );
563 if ( Tcl_Eval(
interp, initScriptExtended ) != TCL_OK )
566 Tcl_UnsetVar(
interp,
"pllibrary", TCL_GLOBAL_ONLY );
568 Tcl_ResetResult(
interp );
571 libDir = Tcl_GetVar(
interp,
"pllibrary", TCL_GLOBAL_ONLY );
575 if ( libDir == NULL )
579 fprintf( stderr,
"trying curdir\n" );
580 if ( Tcl_Access(
"plplot.tcl", 0 ) != 0 )
583 fprintf( stderr,
"couldn't find plplot.tcl in curdir\n" );
588 libDir = Tcl_GetCwd(
interp, &ds );
589 if ( libDir == NULL )
592 fprintf( stderr,
"couldn't get curdir\n" );
596 Tcl_DStringFree( &ds );
597 Tcl_SetVar(
interp,
"pllibrary", libDir, TCL_GLOBAL_ONLY );
599 if ( Tcl_EvalFile(
interp,
"plplot.tcl" ) != TCL_OK )
602 fprintf( stderr,
"error evalling plplot.tcl\n" );
608 if ( libDir == NULL )
611 fprintf( stderr,
"libdir NULL at end of search\n" );
622 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
645 Tcl_AppendResult(
interp,
"Could not find plplot.tcl - please set \
646environment variable PL_LIBRARY to the directory containing that file",
658 for ( cmdInfoPtr =
Cmds; cmdInfoPtr->
name != NULL; cmdInfoPtr++ )
661 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
695 if ( Tcl_ExprBoolean(
interp,
argv[1], &result ) )
697 fprintf( stderr,
"wait_until command \"%s\" failed:\n\t %s\n",
724 int debug = plsc->debug;
725 char *
buf, *ptr = NULL, *dn;
731 buf = (
char *) malloc( 256 *
sizeof (
char ) );
737 fprintf( stderr,
"adding %s to auto_path\n",
TCL_DIR );
739 if (
tcl_cmd(
interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
745 path = Tcl_GetVar(
interp,
"auto_path", 0 );
746 fprintf( stderr,
"auto_path is %s\n", path );
752 if ( ( dn = getenv(
"HOME" ) ) != NULL )
755 Tcl_SetVar(
interp,
"dir", ptr, 0 );
756 if (
tcl_cmd(
interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
762 fprintf( stderr,
"adding %s to auto_path\n", ptr );
763 path = Tcl_GetVar(
interp,
"auto_path", 0 );
764 fprintf( stderr,
"auto_path is %s\n", path );
770#if defined ( PL_TCL_ENV )
771 if ( ( dn = getenv( PL_TCL_ENV ) ) != NULL )
774 Tcl_SetVar(
interp,
"dir", ptr, 0 );
775 if (
tcl_cmd(
interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
781 fprintf( stderr,
"adding %s to auto_path\n", ptr );
782 path = Tcl_GetVar(
interp,
"auto_path", 0 );
783 fprintf( stderr,
"auto_path is %s\n", path );
790#if defined ( PL_HOME_ENV )
791 if ( ( dn = getenv( PL_HOME_ENV ) ) != NULL )
794 Tcl_SetVar(
interp,
"dir", ptr, 0 );
795 if (
tcl_cmd(
interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
801 fprintf( stderr,
"adding %s to auto_path\n", ptr );
802 path = Tcl_GetVar(
interp,
"auto_path", 0 );
803 fprintf( stderr,
"auto_path is %s\n", path );
810 if ( getcwd(
buf, 256 ) == 0 )
812 Tcl_SetResult(
interp,
"Problems with getcwd in pls_auto_path", TCL_STATIC );
819 if (
tcl_cmd(
interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
827 Tcl_SetVar(
interp,
"dir",
BUILD_DIR "/bindings/tk", TCL_GLOBAL_ONLY );
828 if (
tcl_cmd(
interp,
"set auto_path [linsert $auto_path 0 $dir]" ) == TCL_ERROR )
836 fprintf( stderr,
"adding %s to auto_path\n",
buf );
837 path = Tcl_GetVar(
interp,
"auto_path", 0 );
838 fprintf( stderr,
"auto_path is %s\n", path );
858 result = Tcl_VarEval(
interp, cmd, (
char **) NULL );
859 if ( result != TCL_OK )
861 fprintf( stderr,
"TCL command \"%s\" failed:\n\t %s\n",
862 cmd, Tcl_GetStringResult(
interp ) );
932 PLINT nx, ny, kx = 0, lx = 0, ky = 0, ly = 0, nclev;
933 const char *pltrname =
"pltr0";
934 tclMatrix *mattrx = NULL, *mattry = NULL;
935 PLFLT **z, **zused, **zwrapped;
937 int arg3_is_kx = 1, i, j;
947 Tcl_AppendResult(
interp,
"wrong # args: see documentation for ",
948 argv[0], (
char *) NULL );
954 if ( matf->
dim != 2 )
956 Tcl_SetResult(
interp,
"Must use 2-d data.", TCL_STATIC );
969 for ( i = 0; i < nx; i++ )
971 for ( j = 0; j < ny; j++ )
981 for ( i = 0; i < (int) strlen(
argv[2] ) && arg3_is_kx; i++ )
982 if ( !isdigit(
argv[2][i] ) )
990 Tcl_SetResult(
interp,
"plcont, bogus syntax", TCL_STATIC );
995 kx = atoi(
argv[3] );
996 lx = atoi(
argv[4] );
997 ky = atoi(
argv[5] );
998 ly = atoi(
argv[6] );
1012 Tcl_SetResult(
interp,
"plcont, bogus syntax", TCL_STATIC );
1017 nclev = matclev->
n[0];
1019 if ( matclev->
dim != 1 )
1021 Tcl_SetResult(
interp,
"clev must be 1-d matrix.", TCL_STATIC );
1042 wrap = atoi(
argv[0] );
1054 Tcl_SetResult(
interp,
"plcont, bogus syntax, too many args.", TCL_STATIC );
1060 if ( !strcmp( pltrname,
"pltr0" ) )
1068 Tcl_SetResult(
interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
1072 else if ( !strcmp( pltrname,
"pltr1" ) )
1077 cgrid1.
yg = mattry->fdata;
1084 Tcl_SetResult(
interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
1088 if ( mattrx->
dim != 1 || mattry->dim != 1 )
1090 Tcl_SetResult(
interp,
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
1094 pltr_data = &cgrid1;
1096 else if ( !strcmp( pltrname,
"pltr2" ) )
1109 for ( i = 0; i < nx; i++ )
1110 for ( j = 0; j < ny; j++ )
1111 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1114 for ( i = 0; i < nx; i++ )
1115 for ( j = 0; j < ny; j++ )
1116 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1118 else if ( wrap == 1 )
1128 for ( i = 0; i < nx; i++ )
1129 for ( j = 0; j < ny; j++ )
1130 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1133 for ( i = 0; i < nx; i++ )
1135 for ( j = 0; j < ny; j++ )
1137 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1138 zwrapped[i][j] = z[i][j];
1142 for ( j = 0; j < ny; j++ )
1144 cgrid2.
xg[nx][j] = cgrid2.
xg[0][j];
1145 cgrid2.
yg[nx][j] = cgrid2.
yg[0][j];
1146 zwrapped[nx][j] = zwrapped[0][j];
1155 else if ( wrap == 2 )
1165 for ( i = 0; i < nx; i++ )
1166 for ( j = 0; j < ny; j++ )
1167 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1170 for ( i = 0; i < nx; i++ )
1172 for ( j = 0; j < ny; j++ )
1174 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1175 zwrapped[i][j] = z[i][j];
1179 for ( i = 0; i < nx; i++ )
1181 cgrid2.
xg[i][ny] = cgrid2.
xg[i][0];
1182 cgrid2.
yg[i][ny] = cgrid2.
yg[i][0];
1183 zwrapped[i][ny] = zwrapped[i][0];
1194 Tcl_SetResult(
interp,
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
1199 pltr_data = &cgrid2;
1203 Tcl_AppendResult(
interp,
1204 "Unrecognized coordinate transformation spec:",
1205 pltrname,
", must be pltr0 pltr1 or pltr2.",
1225 matclev->
fdata, nclev,
1236 if ( pltr ==
pltr1 )
1241 else if ( pltr ==
pltr2 )
1267 || ( strcmp(
argv[1],
"NULL" ) == 0 ) && ( strcmp(
argv[2],
"NULL" ) == 0 ) )
1273 else if (
argc != 4 )
1275 Tcl_AppendResult(
interp,
"wrong # args: see documentation for ",
1276 argv[0], (
char *) NULL );
1282 if ( matx->
dim != 1 )
1284 Tcl_SetResult(
interp,
"plsvect: Must use 1-d data.", TCL_STATIC );
1291 if ( maty->
dim != 1 )
1293 Tcl_SetResult(
interp,
"plsvect: Must use 1-d data.", TCL_STATIC );
1297 if ( maty->
n[0] != npts )
1299 Tcl_SetResult(
interp,
"plsvect: Arrays must be of equal length", TCL_STATIC );
1320 const char *pltrname =
"pltr0";
1321 tclMatrix *mattrx = NULL, *mattry = NULL;
1322 PLFLT **u, **v, **uused, **vused, **uwrapped, **vwrapped;
1335 Tcl_AppendResult(
interp,
"wrong # args: see documentation for ",
1336 argv[0], (
char *) NULL );
1342 if ( matu->
dim != 2 )
1344 Tcl_SetResult(
interp,
"Must use 2-d data.", TCL_STATIC );
1357 for ( i = 0; i < nx; i++ )
1359 for ( j = 0; j < ny; j++ )
1368 if ( matv->
dim != 2 )
1370 Tcl_SetResult(
interp,
"Must use 2-d data.", TCL_STATIC );
1383 for ( i = 0; i < nx; i++ )
1385 for ( j = 0; j < ny; j++ )
1398 Tcl_SetResult(
interp,
"plvect, bogus syntax", TCL_STATIC );
1402 scaling = atof(
argv[0] );
1420 wrap = atoi(
argv[0] );
1432 Tcl_SetResult(
interp,
"plvect, bogus syntax, too many args.", TCL_STATIC );
1438 if ( !strcmp( pltrname,
"pltr0" ) )
1447 Tcl_SetResult(
interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
1451 else if ( !strcmp( pltrname,
"pltr1" ) )
1456 cgrid1.
yg = mattry->fdata;
1464 Tcl_SetResult(
interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
1468 if ( mattrx->
dim != 1 || mattry->dim != 1 )
1470 Tcl_SetResult(
interp,
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
1474 pltr_data = &cgrid1;
1476 else if ( !strcmp( pltrname,
"pltr2" ) )
1490 for ( i = 0; i < nx; i++ )
1491 for ( j = 0; j < ny; j++ )
1492 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1494 for ( i = 0; i < nx; i++ )
1496 for ( j = 0; j < ny; j++ )
1498 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1502 else if ( wrap == 1 )
1515 for ( i = 0; i < nx; i++ )
1516 for ( j = 0; j < ny; j++ )
1517 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1520 for ( i = 0; i < nx; i++ )
1522 for ( j = 0; j < ny; j++ )
1524 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1525 uwrapped[i][j] = u[i][j];
1526 vwrapped[i][j] = v[i][j];
1530 for ( j = 0; j < ny; j++ )
1532 cgrid2.
xg[nx][j] = cgrid2.
xg[0][j];
1533 cgrid2.
yg[nx][j] = cgrid2.
yg[0][j];
1534 uwrapped[nx][j] = uwrapped[0][j];
1535 vwrapped[nx][j] = vwrapped[0][j];
1544 else if ( wrap == 2 )
1556 for ( i = 0; i < nx; i++ )
1557 for ( j = 0; j < ny; j++ )
1558 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
1561 for ( i = 0; i < nx; i++ )
1563 for ( j = 0; j < ny; j++ )
1565 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
1566 uwrapped[i][j] = u[i][j];
1567 vwrapped[i][j] = v[i][j];
1571 for ( i = 0; i < nx; i++ )
1573 cgrid2.
xg[i][ny] = cgrid2.
xg[i][0];
1574 cgrid2.
yg[i][ny] = cgrid2.
yg[i][0];
1575 uwrapped[i][ny] = uwrapped[i][0];
1576 vwrapped[i][ny] = vwrapped[i][0];
1588 Tcl_SetResult(
interp,
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
1593 pltr_data = &cgrid2;
1597 Tcl_AppendResult(
interp,
1598 "Unrecognized coordinate transformation spec:",
1599 pltrname,
", must be pltr0 pltr1 or pltr2.",
1607 plvect( (
const PLFLT *
const *) uused, (
const PLFLT *
const *) vused, nx, ny,
1608 scaling, pltr, pltr_data );
1618 if ( pltr ==
pltr1 )
1623 else if ( pltr ==
pltr2 )
1659#ifdef PLPLOTTCLTK_NON_REDACTED_API
1662 nx = atoi(
argv[4] );
1663 ny = atoi(
argv[5] );
1664 opt = atoi(
argv[6] );
1675 Tcl_SetResult(
interp,
"x y and z must all be float", TCL_STATIC );
1679 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1680 maty->
dim != 1 || maty->
n[0] != ny ||
1681 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
1683 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
1690 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1691 for ( i = 0; i < nx; i++ )
1692 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1694 else if (
argc == 5 )
1699 opt = atoi(
argv[4] );
1710 Tcl_SetResult(
interp,
"x y and z must all be float", TCL_STATIC );
1714 nx = matx->
n[0]; ny = maty->
n[0];
1716 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1717 maty->
dim != 1 || maty->
n[0] != ny ||
1718 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
1720 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
1727 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1728 for ( i = 0; i < nx; i++ )
1729 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1731 else if (
argc == 3 )
1733 Tcl_SetResult(
interp,
"unimplemented", TCL_STATIC );
1738 Tcl_AppendResult(
interp,
"wrong # args: should be \"plmesh ",
1739 "x y z nx ny opt\", or a valid contraction ",
1740 "thereof.", (
char *) NULL );
1744 plmesh( x, y, (
const PLFLT *
const *) z, nx, ny, opt );
1750 else if (
argc == 5 )
1785 PLINT nx, ny, opt, nlev = 10;
1789 tclMatrix *matx, *maty, *matz, *matPtr, *matlev;
1792#ifdef PLPLOTTCLTK_NON_REDACTED_API
1795 nlev = atoi(
argv[8] );
1796 nx = atoi(
argv[4] );
1797 ny = atoi(
argv[5] );
1798 opt = atoi(
argv[6] );
1812 Tcl_SetResult(
interp,
"x y z and clevel must all be float", TCL_STATIC );
1816 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1817 maty->
dim != 1 || maty->
n[0] != ny ||
1818 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
1819 matlev->
dim != 1 || matlev->
n[0] != nlev )
1821 Tcl_SetResult(
interp,
"popo Inconsistent dimensions", TCL_STATIC );
1827 clev = matlev->
fdata;
1829 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1830 for ( i = 0; i < nx; i++ )
1831 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1834 else if (
argc == 8 )
1836 nx = atoi(
argv[4] );
1837 ny = atoi(
argv[5] );
1838 opt = atoi(
argv[6] );
1851 Tcl_SetResult(
interp,
"x y z and clevel must all be float", TCL_STATIC );
1855 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1856 maty->
dim != 1 || maty->
n[0] != ny ||
1857 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
1858 matlev->
dim != 1 || matlev->
n[0] != nlev )
1860 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
1866 clev = matlev->
fdata;
1867 nlev = matlev->
n[0];
1869 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1870 for ( i = 0; i < nx; i++ )
1871 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1874 else if (
argc == 7 )
1876 nx = atoi(
argv[4] );
1877 ny = atoi(
argv[5] );
1878 opt = atoi(
argv[6] );
1890 Tcl_SetResult(
interp,
"x y and z must all be float", TCL_STATIC );
1894 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1895 maty->
dim != 1 || maty->
n[0] != ny ||
1896 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
1898 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
1905 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1906 for ( i = 0; i < nx; i++ )
1907 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1910 else if (
argc == 6 )
1915 opt = atoi(
argv[4] );
1925 nlev = matlev->
n[0];
1932 Tcl_SetResult(
interp,
"x y z and clevel must all be float", TCL_STATIC );
1936 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1937 maty->
dim != 1 || maty->
n[0] != ny ||
1938 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
1939 matlev->
dim != 1 || matlev->
n[0] != nlev )
1941 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
1947 clev = matlev->
fdata;
1949 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1950 for ( i = 0; i < nx; i++ )
1951 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1954 else if (
argc == 5 )
1956 opt = atoi(
argv[4] );
1968 Tcl_SetResult(
interp,
"x y and z must all be float", TCL_STATIC );
1972 nx = matx->
n[0]; ny = maty->
n[0];
1974 if ( matx->
dim != 1 || matx->
n[0] != nx ||
1975 maty->
dim != 1 || maty->
n[0] != ny ||
1976 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
1978 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
1985 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
1986 for ( i = 0; i < nx; i++ )
1987 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
1989 else if (
argc == 3 )
1991 Tcl_SetResult(
interp,
"unimplemented", TCL_STATIC );
1996 Tcl_AppendResult(
interp,
"wrong # args: should be \"plmeshc ",
1997 "x y z nx ny opt clevel nlevel\", or a valid contraction ",
1998 "thereof.", (
char *) NULL );
2002 plmeshc( x, y, (
const PLFLT *
const *) z, nx, ny, opt, clev, nlev );
2039 PLINT nx, ny, opt, side;
2044#ifdef PLPLOTTCLTK_NON_REDACTED_API
2047 nx = atoi(
argv[4] );
2048 ny = atoi(
argv[5] );
2049 opt = atoi(
argv[6] );
2050 side = atoi(
argv[7] );
2061 Tcl_SetResult(
interp,
"x y and z must all be float", TCL_STATIC );
2065 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2066 maty->
dim != 1 || maty->
n[0] != ny ||
2067 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
2069 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2076 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2077 for ( i = 0; i < nx; i++ )
2078 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2080 else if (
argc == 6 )
2085 opt = atoi(
argv[4] );
2086 side = atoi(
argv[5] );
2097 Tcl_SetResult(
interp,
"x y and z must all be float", TCL_STATIC );
2101 nx = matx->
n[0]; ny = maty->
n[0];
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 )
2107 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2114 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2115 for ( i = 0; i < nx; i++ )
2116 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2118 else if (
argc == 4 )
2120 Tcl_SetResult(
interp,
"unimplemented", TCL_STATIC );
2125 Tcl_AppendResult(
interp,
"wrong # args: should be \"plot3d ",
2126 "x y z nx ny opt side\", or a valid contraction ",
2127 "thereof.", (
char *) NULL );
2131 plot3d( x, y, (
const PLFLT *
const *) z, nx, ny, opt, side );
2137 else if (
argc == 6 )
2172 PLINT nx, ny, opt, nlev = 10;
2176 tclMatrix *matx, *maty, *matz, *matPtr, *matlev;
2179#ifdef PLPLOTTCLTK_NON_REDACTED_API
2182 nlev = atoi(
argv[8] );
2183 nx = atoi(
argv[4] );
2184 ny = atoi(
argv[5] );
2185 opt = atoi(
argv[6] );
2199 Tcl_SetResult(
interp,
"x y z and clevel must all be float", TCL_STATIC );
2203 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2204 maty->
dim != 1 || maty->
n[0] != ny ||
2205 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2206 matlev->
dim != 1 || matlev->
n[0] != nlev )
2208 Tcl_SetResult(
interp,
"popo Inconsistent dimensions", TCL_STATIC );
2214 clev = matlev->
fdata;
2216 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2217 for ( i = 0; i < nx; i++ )
2218 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2221 else if (
argc == 8 )
2223 nx = atoi(
argv[4] );
2224 ny = atoi(
argv[5] );
2225 opt = atoi(
argv[6] );
2238 Tcl_SetResult(
interp,
"x y z and clevel must all be float", TCL_STATIC );
2242 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2243 maty->
dim != 1 || maty->
n[0] != ny ||
2244 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2245 matlev->
dim != 1 || matlev->
n[0] != nlev )
2247 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2253 clev = matlev->
fdata;
2254 nlev = matlev->
n[0];
2256 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2257 for ( i = 0; i < nx; i++ )
2258 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2261 else if (
argc == 7 )
2263 nx = atoi(
argv[4] );
2264 ny = atoi(
argv[5] );
2265 opt = atoi(
argv[6] );
2277 Tcl_SetResult(
interp,
"x y and z must all be float", TCL_STATIC );
2281 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2282 maty->
dim != 1 || maty->
n[0] != ny ||
2283 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
2285 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2292 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2293 for ( i = 0; i < nx; i++ )
2294 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2297 else if (
argc == 6 )
2302 opt = atoi(
argv[4] );
2312 nlev = matlev->
n[0];
2319 Tcl_SetResult(
interp,
"x y z and clevel must all be float", TCL_STATIC );
2323 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2324 maty->
dim != 1 || maty->
n[0] != ny ||
2325 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2326 matlev->
dim != 1 || matlev->
n[0] != nlev )
2328 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2334 clev = matlev->
fdata;
2336 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2337 for ( i = 0; i < nx; i++ )
2338 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2341 else if (
argc == 5 )
2343 opt = atoi(
argv[4] );
2355 Tcl_SetResult(
interp,
"x y and z must all be float", TCL_STATIC );
2359 nx = matx->
n[0]; ny = maty->
n[0];
2361 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2362 maty->
dim != 1 || maty->
n[0] != ny ||
2363 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
2365 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2372 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2373 for ( i = 0; i < nx; i++ )
2374 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2376 else if (
argc == 3 )
2378 Tcl_SetResult(
interp,
"unimplemented", TCL_STATIC );
2383 Tcl_AppendResult(
interp,
"wrong # args: should be \"plot3dc ",
2384 "x y z nx ny opt clevel nlevel\", or a valid contraction ",
2385 "thereof.", (
char *) NULL );
2389 plot3dc( x, y, (
const PLFLT *
const *) z, nx, ny, opt, clev, nlev );
2430 PLINT nx, ny, opt, nlev = 10;
2434 tclMatrix *matx, *maty, *matz, *matPtr, *matlev;
2437#ifdef PLPLOTTCLTK_NON_REDACTED_API
2440 nlev = atoi(
argv[8] );
2441 nx = atoi(
argv[4] );
2442 ny = atoi(
argv[5] );
2443 opt = atoi(
argv[6] );
2457 Tcl_SetResult(
interp,
"x y z and clevel must all be float", TCL_STATIC );
2461 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2462 maty->
dim != 1 || maty->
n[0] != ny ||
2463 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2464 matlev->
dim != 1 || matlev->
n[0] != nlev )
2466 Tcl_SetResult(
interp,
"popo Inconsistent dimensions", TCL_STATIC );
2472 clev = matlev->
fdata;
2474 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2475 for ( i = 0; i < nx; i++ )
2476 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2479 else if (
argc == 8 )
2481 nx = atoi(
argv[4] );
2482 ny = atoi(
argv[5] );
2483 opt = atoi(
argv[6] );
2496 Tcl_SetResult(
interp,
"x y z and clevel must all be float", TCL_STATIC );
2500 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2501 maty->
dim != 1 || maty->
n[0] != ny ||
2502 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2503 matlev->
dim != 1 || matlev->
n[0] != nlev )
2505 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2511 clev = matlev->
fdata;
2512 nlev = matlev->
n[0];
2514 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2515 for ( i = 0; i < nx; i++ )
2516 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2519 else if (
argc == 7 )
2521 nx = atoi(
argv[4] );
2522 ny = atoi(
argv[5] );
2523 opt = atoi(
argv[6] );
2535 Tcl_SetResult(
interp,
"x y and z must all be float", TCL_STATIC );
2539 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2540 maty->
dim != 1 || maty->
n[0] != ny ||
2541 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
2543 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2550 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2551 for ( i = 0; i < nx; i++ )
2552 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2555 else if (
argc == 6 )
2560 opt = atoi(
argv[4] );
2570 nlev = matlev->
n[0];
2577 Tcl_SetResult(
interp,
"x y z and clevel must all be float", TCL_STATIC );
2581 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2582 maty->
dim != 1 || maty->
n[0] != ny ||
2583 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2584 matlev->
dim != 1 || matlev->
n[0] != nlev )
2586 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2592 clev = matlev->
fdata;
2594 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2595 for ( i = 0; i < nx; i++ )
2596 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2599 else if (
argc == 5 )
2601 opt = atoi(
argv[4] );
2613 Tcl_SetResult(
interp,
"x y and z must all be float", TCL_STATIC );
2617 nx = matx->
n[0]; ny = maty->
n[0];
2619 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2620 maty->
dim != 1 || maty->
n[0] != ny ||
2621 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny )
2623 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2630 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2631 for ( i = 0; i < nx; i++ )
2632 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2634 else if (
argc == 3 )
2636 Tcl_SetResult(
interp,
"unimplemented", TCL_STATIC );
2641 Tcl_AppendResult(
interp,
"wrong # args: should be \"plsurf3d ",
2642 "x y z nx ny opt clevel nlevel\", or a valid contraction ",
2643 "thereof.", (
char *) NULL );
2647 plsurf3d( x, y, (
const PLFLT *
const *) z, nx, ny, opt, clev, nlev );
2653 else if (
argc == 5 )
2688 PLINT nx, ny, opt, nlev = 10;
2691 PLINT indexxmin, indexxmax;
2693 tclMatrix *matx, *maty, *matz, *matPtr, *matlev;
2695 PLINT *idxymin, *idxymax;
2699#ifdef PLPLOTTCLTK_NON_REDACTED_API
2702 nlev = atoi(
argv[8] );
2703 nx = atoi(
argv[4] );
2704 ny = atoi(
argv[5] );
2705 opt = atoi(
argv[6] );
2707 indexxmin = atoi(
argv[9] );
2708 indexxmax = atoi(
argv[10] );
2714 Tcl_SetResult(
interp,
"indexymin and indexymax must be integer matrices", TCL_STATIC );
2730 Tcl_SetResult(
interp,
"x y z and clevel must all be float matrices", TCL_STATIC );
2734 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2735 maty->
dim != 1 || maty->
n[0] != ny ||
2736 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2737 matlev->
dim != 1 || matlev->
n[0] != nlev ||
2738 indexymin->
dim != 1 || indexymin->
n[0] != indexxmax ||
2739 indexymax->
dim != 1 || indexymax->
n[0] != indexxmax )
2741 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2747 clev = matlev->
fdata;
2749 idxymin = indexymin->
idata;
2750 idxymax = indexymax->
idata;
2752 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2753 for ( i = 0; i < nx; i++ )
2754 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2757 else if (
argc == 12 )
2759 nx = atoi(
argv[4] );
2760 ny = atoi(
argv[5] );
2761 opt = atoi(
argv[6] );
2763 indexxmin = atoi(
argv[8] );
2764 indexxmax = atoi(
argv[9] );
2770 Tcl_SetResult(
interp,
"indexymin and indexymax must be integer matrices", TCL_STATIC );
2785 Tcl_SetResult(
interp,
"x y z and clevel must all be float matrices", TCL_STATIC );
2789 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2790 maty->
dim != 1 || maty->
n[0] != ny ||
2791 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2792 matlev->
dim != 1 || matlev->
n[0] != nlev ||
2793 indexymin->
dim != 1 || indexymin->
n[0] != indexxmax ||
2794 indexymax->
dim != 1 || indexymax->
n[0] != indexxmax )
2796 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2802 clev = matlev->
fdata;
2803 nlev = matlev->
n[0];
2805 idxymin = indexymin->
idata;
2806 idxymax = indexymax->
idata;
2808 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2809 for ( i = 0; i < nx; i++ )
2810 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2813 else if (
argc == 11 )
2815 nx = atoi(
argv[4] );
2816 ny = atoi(
argv[5] );
2817 opt = atoi(
argv[6] );
2820 indexxmin = atoi(
argv[7] );
2821 indexxmax = atoi(
argv[8] );
2827 Tcl_SetResult(
interp,
"indexymin and indexymax must be integer matrices", TCL_STATIC );
2840 Tcl_SetResult(
interp,
"x y and z must all be float matrices", TCL_STATIC );
2844 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2845 maty->
dim != 1 || maty->
n[0] != ny ||
2846 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2847 indexymin->
dim != 1 || indexymin->
n[0] != indexxmax ||
2848 indexymax->
dim != 1 || indexymax->
n[0] != indexxmax )
2850 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2857 idxymin = indexymin->
idata;
2858 idxymax = indexymax->
idata;
2860 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2861 for ( i = 0; i < nx; i++ )
2862 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2865 else if (
argc == 9 )
2870 indexxmin = atoi(
argv[6] );
2876 Tcl_SetResult(
interp,
"indexymin and indexymax must be integer matrices", TCL_STATIC );
2879 indexxmax = indexymin->
n[0];
2889 opt = atoi(
argv[4] );
2896 Tcl_SetResult(
interp,
"x y z and clevel must all be float matrices", TCL_STATIC );
2900 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2901 maty->
dim != 1 || maty->
n[0] != ny ||
2902 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2903 matlev->
dim != 1 || matlev->
n[0] != nlev ||
2904 indexymin->
dim != 1 || indexymin->
n[0] != indexxmax ||
2905 indexymax->
dim != 1 || indexymax->
n[0] != indexxmax )
2907 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2913 clev = matlev->
fdata;
2914 nlev = matlev->
n[0];
2916 idxymin = indexymin->
idata;
2917 idxymax = indexymax->
idata;
2919 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2920 for ( i = 0; i < nx; i++ )
2921 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2924 else if (
argc == 8 )
2926 opt = atoi(
argv[4] );
2929 indexxmin = atoi(
argv[5] );
2935 Tcl_SetResult(
interp,
"indexymin and indexymax must be integer matrices", TCL_STATIC );
2938 indexxmax = indexymin->
n[0];
2949 Tcl_SetResult(
interp,
"x y and z must all be float", TCL_STATIC );
2953 nx = matx->
n[0]; ny = maty->
n[0];
2955 if ( matx->
dim != 1 || matx->
n[0] != nx ||
2956 maty->
dim != 1 || maty->
n[0] != ny ||
2957 matz->
dim != 2 || matz->
n[0] != nx || matz->
n[1] != ny ||
2958 indexymin->
dim != 1 || indexymin->
n[0] != indexxmax ||
2959 indexymax->
dim != 1 || indexymax->
n[0] != indexxmax )
2961 Tcl_SetResult(
interp,
"Inconsistent dimensions", TCL_STATIC );
2968 idxymin = indexymin->
idata;
2969 idxymax = indexymax->
idata;
2971 z = (
PLFLT **) malloc( (
size_t) nx *
sizeof (
PLFLT * ) );
2972 for ( i = 0; i < nx; i++ )
2973 z[i] = &matz->
fdata[
I2D( i, 0 ) ];
2975 else if (
argc == 2 )
2977 Tcl_SetResult(
interp,
"unimplemented", TCL_STATIC );
2982 Tcl_AppendResult(
interp,
"wrong # args: should be \"plsurf3dl ",
2983 "x y z nx ny opt clevel nlevel indexxmin indexxmax indexymin ",
2984 "indexymax\", or a valid contraction thereof.", (
char *) NULL );
2988 plsurf3dl( x, y, (
const PLFLT *
const *) z, nx, ny, opt, clev, nlev, indexxmin, indexxmax, idxymin, idxymax );
2994 else if (
argc == 9 ||
argc == 10 )
3018 Tcl_AppendResult(
interp,
"wrong # args: ",
3019 argv[0],
" takes no arguments", (
char *) NULL );
3024 Tcl_SetObjResult(
interp, Tcl_NewDoubleObj( (
double)
plrandd() ) );
3041 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
3042 argv[0],
" option ?argument?\"", (
char *) NULL );
3081 tclMatrix *matPtr, *matz, *mattrx = NULL, *mattry = NULL;
3082 PLFLT **z, **zused, **zwrapped;
3087 PLINT min_col = 1, max_col = 0;
3088 PLFLT min_wid = 0., max_wid = 0.;
3090 const char *pltrname =
"pltr0";
3100 Tcl_AppendResult(
interp,
"bogus syntax for plshade, see doc.",
3106 if ( matz->
dim != 2 )
3108 Tcl_SetResult(
interp,
"Must plot a 2-d matrix.", TCL_STATIC );
3121 for ( i = 0; i < nx; i++ )
3123 for ( j = 0; j < ny; j++ )
3129 xmin = atof(
argv[2] );
3130 xmax = atof(
argv[3] );
3131 ymin = atof(
argv[4] );
3132 ymax = atof(
argv[5] );
3135 sh_cmap = atoi(
argv[8] );
3136 sh_col = atof(
argv[9] );
3137 sh_wid = atof(
argv[10] );
3138 min_col = atoi(
argv[11] );
3139 min_wid = atoi(
argv[12] );
3140 max_col = atoi(
argv[13] );
3141 max_wid = atof(
argv[14] );
3142 rect = atoi(
argv[15] );
3154 else if (
argc && !strcmp(
argv[0],
"NULL" ) )
3162 wrap = atoi(
argv[0] );
3168 Tcl_SetResult(
interp,
"plshade: bogus arg list", TCL_STATIC );
3175 if ( !strcmp( pltrname,
"NULL" ) )
3183 Tcl_SetResult(
interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
3187 else if ( !strcmp( pltrname,
"pltr0" ) )
3195 Tcl_SetResult(
interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
3199 else if ( !strcmp( pltrname,
"pltr1" ) )
3204 cgrid1.
yg = mattry->fdata;
3211 Tcl_SetResult(
interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
3215 if ( mattrx->
dim != 1 || mattry->dim != 1 )
3217 Tcl_SetResult(
interp,
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
3221 pltr_data = &cgrid1;
3223 else if ( !strcmp( pltrname,
"pltr2" ) )
3236 for ( i = 0; i < nx; i++ )
3237 for ( j = 0; j < ny; j++ )
3238 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
3241 for ( i = 0; i < nx; i++ )
3242 for ( j = 0; j < ny; j++ )
3243 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
3245 else if ( wrap == 1 )
3255 for ( i = 0; i < nx; i++ )
3256 for ( j = 0; j < ny; j++ )
3257 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
3260 for ( i = 0; i < nx; i++ )
3262 for ( j = 0; j < ny; j++ )
3264 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
3265 zwrapped[i][j] = z[i][j];
3269 for ( j = 0; j < ny; j++ )
3271 cgrid2.
xg[nx][j] = cgrid2.
xg[0][j];
3272 cgrid2.
yg[nx][j] = cgrid2.
yg[0][j];
3273 zwrapped[nx][j] = zwrapped[0][j];
3282 else if ( wrap == 2 )
3292 for ( i = 0; i < nx; i++ )
3293 for ( j = 0; j < ny; j++ )
3294 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
3297 for ( i = 0; i < nx; i++ )
3299 for ( j = 0; j < ny; j++ )
3301 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
3302 zwrapped[i][j] = z[i][j];
3306 for ( i = 0; i < nx; i++ )
3308 cgrid2.
xg[i][ny] = cgrid2.
xg[i][0];
3309 cgrid2.
yg[i][ny] = cgrid2.
yg[i][0];
3310 zwrapped[i][ny] = zwrapped[i][0];
3321 Tcl_SetResult(
interp,
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
3326 pltr_data = &cgrid2;
3330 Tcl_AppendResult(
interp,
3331 "Unrecognized coordinate transformation spec:",
3332 pltrname,
", must be NULL, pltr0, pltr1, or pltr2.",
3340 xmin, xmax, ymin, ymax,
3342 min_col, min_wid, max_col, max_wid,
3343 plfill, rect, pltr, pltr_data );
3353 if ( pltr ==
pltr1 )
3358 else if ( pltr ==
pltr2 )
3398 tclMatrix *matPtr, *matz, *mattrx = NULL, *mattry = NULL;
3400 PLFLT **z, **zused, **zwrapped;
3401 PLFLT xmin, xmax, ymin, ymax;
3402 PLINT cont_color = 0;
3403 PLFLT fill_width = 0., cont_width = 0.;
3405 const char *pltrname =
"pltr0";
3411 int nx, ny, nlevel, i, j;
3415 Tcl_AppendResult(
interp,
"bogus syntax for plshades, see doc.",
3421 if ( matz->
dim != 2 )
3423 Tcl_SetResult(
interp,
"Must plot a 2-d matrix.", TCL_STATIC );
3436 for ( i = 0; i < nx; i++ )
3438 for ( j = 0; j < ny; j++ )
3444 xmin = atof(
argv[2] );
3445 xmax = atof(
argv[3] );
3446 ymin = atof(
argv[4] );
3447 ymax = atof(
argv[5] );
3450 nlevel = matclevel->
n[0];
3451 if ( matclevel->
dim != 1 )
3453 Tcl_SetResult(
interp,
"clevel must be 1-d matrix.", TCL_STATIC );
3457 fill_width = atof(
argv[7] );
3458 cont_color = atoi(
argv[8] );
3459 cont_width = atof(
argv[9] );
3460 rect = atoi(
argv[10] );
3472 else if (
argc && !strcmp(
argv[0],
"NULL" ) )
3480 wrap = atoi(
argv[0] );
3486 Tcl_SetResult(
interp,
"plshades: bogus arg list", TCL_STATIC );
3493 if ( !strcmp( pltrname,
"NULL" ) )
3501 Tcl_SetResult(
interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
3505 else if ( !strcmp( pltrname,
"pltr0" ) )
3513 Tcl_SetResult(
interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
3517 else if ( !strcmp( pltrname,
"pltr1" ) )
3522 cgrid1.
yg = mattry->fdata;
3529 Tcl_SetResult(
interp,
"Must use pltr2 if want wrapping.", TCL_STATIC );
3533 if ( mattrx->
dim != 1 || mattry->dim != 1 )
3535 Tcl_SetResult(
interp,
"Must use 1-d coord arrays with pltr1.", TCL_STATIC );
3539 pltr_data = &cgrid1;
3541 else if ( !strcmp( pltrname,
"pltr2" ) )
3554 for ( i = 0; i < nx; i++ )
3555 for ( j = 0; j < ny; j++ )
3556 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
3559 for ( i = 0; i < nx; i++ )
3560 for ( j = 0; j < ny; j++ )
3561 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
3563 else if ( wrap == 1 )
3573 for ( i = 0; i < nx; i++ )
3574 for ( j = 0; j < ny; j++ )
3575 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
3578 for ( i = 0; i < nx; i++ )
3580 for ( j = 0; j < ny; j++ )
3582 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
3583 zwrapped[i][j] = z[i][j];
3587 for ( j = 0; j < ny; j++ )
3589 cgrid2.
xg[nx][j] = cgrid2.
xg[0][j];
3590 cgrid2.
yg[nx][j] = cgrid2.
yg[0][j];
3591 zwrapped[nx][j] = zwrapped[0][j];
3600 else if ( wrap == 2 )
3610 for ( i = 0; i < nx; i++ )
3611 for ( j = 0; j < ny; j++ )
3612 cgrid2.
xg[i][j] = mattrx->
fdata[
I2D( i, j ) ];
3615 for ( i = 0; i < nx; i++ )
3617 for ( j = 0; j < ny; j++ )
3619 cgrid2.
yg[i][j] = mattry->fdata[
I2D( i, j ) ];
3620 zwrapped[i][j] = z[i][j];
3624 for ( i = 0; i < nx; i++ )
3626 cgrid2.
xg[i][ny] = cgrid2.
xg[i][0];
3627 cgrid2.
yg[i][ny] = cgrid2.
yg[i][0];
3628 zwrapped[i][ny] = zwrapped[i][0];
3639 Tcl_SetResult(
interp,
"Invalid wrap specifier, must be <empty>, 0, 1, or 2.", TCL_STATIC );
3644 pltr_data = &cgrid2;
3648 Tcl_AppendResult(
interp,
3649 "Unrecognized coordinate transformation spec:",
3650 pltrname,
", must be NULL, pltr0, pltr1, or pltr2.",
3658 xmin, xmax, ymin, ymax,
3659 matclevel->
fdata, nlevel, fill_width, cont_color, cont_width,
3660 plfill, rect, pltr, pltr_data );
3670 if ( pltr ==
pltr1 )
3675 else if ( pltr ==
pltr2 )
3708 sprintf( cmd,
"matrix %cx f %d", (
char) 1, n );
3715 sprintf( cmd,
"matrix %cy f %d", (
char) 1, n );
3723 sprintf( cmd,
"%cx", (
char) 1 );
3732 sprintf( cmd,
"%cy", (
char) 1 );
3741 for ( i = 0; i < n; i++ )
3743 xPtr->
fdata[i] = x[i];
3744 yPtr->
fdata[i] = y[i];
3748 sprintf( cmd,
"%s %d %cx %cy",
transform_name, n, (
char) 1, (
char) 1 );
3758 for ( i = 0; i < n; i++ )
3760 x[i] = xPtr->
fdata[i];
3761 y[i] = yPtr->
fdata[i];
3767 sprintf( cmd,
"rename %cx {}; rename %cy {}", (
char) 1, (
char) 1 );
3787 PLFLT minlong, maxlong, minlat, maxlat;
3798 else if (
argc == 7 )
3817 Tcl_AppendResult(
interp,
"bogus syntax for plmap, see doc.",
3822 minlong = atof(
argv[idxname + 1] );
3823 maxlong = atof(
argv[idxname + 2] );
3824 minlat = atof(
argv[idxname + 3] );
3825 maxlat = atof(
argv[idxname + 4] );
3826 if ( transform && idxname == 2 )
3833 plmap( NULL,
argv[idxname], minlong, maxlong, minlat, maxlat );
3854 int *entries = NULL;
3861 if ( Tcl_SplitList(
interp,
string, n, (
const char ***) &
argv ) == TCL_OK )
3863 entries = (
int *) malloc( ( *n ) *
sizeof (
int ) );
3864 for ( i = 0; i < *n; i++ )
3866 entries[i] = atoi(
argv[i] );
3868 Tcl_Free( (
char *)
argv );
3874 entries = (
int *) malloc( ( *n ) *
sizeof (
int ) );
3875 for ( i = 0; i < *n; i++ )
3877 entries[i] = mati->
idata[i];
3898 PLFLT minlong, maxlong, minlat, maxlat;
3937 if ( Tcl_GetDouble(
interp,
argv[2], &dminlong ) == TCL_OK )
3969 Tcl_AppendResult(
interp,
"bogus syntax for plmapfill, see doc.",
3974 minlong = atof(
argv[idxname + 1] );
3975 maxlong = atof(
argv[idxname + 2] );
3976 minlat = atof(
argv[idxname + 3] );
3977 maxlat = atof(
argv[idxname + 4] );
3978 if ( transform && idxname == 2 )
3985 plmapfill( NULL,
argv[idxname], minlong, maxlong, minlat, maxlat, entries, nentries );
4010 PLFLT minlong, maxlong, minlat, maxlat;
4050 if ( Tcl_GetDouble(
interp,
argv[2], &dminlong ) == TCL_OK )
4084 Tcl_AppendResult(
interp,
"bogus syntax for plmapline, see doc.",
4089 minlong = atof(
argv[idxname + 1] );
4090 maxlong = atof(
argv[idxname + 2] );
4091 minlat = atof(
argv[idxname + 3] );
4092 maxlat = atof(
argv[idxname + 4] );
4093 if ( transform && idxname == 2 )
4100 plmapline( NULL,
argv[idxname], minlong, maxlong, minlat, maxlat, entries, nentries );
4125 PLFLT minlong, maxlong, minlat, maxlat;
4136 Tcl_AppendResult(
interp,
"bogus syntax for plmapstring, see doc.",
4171 if ( Tcl_GetDouble(
interp,
argv[3], &dminlong ) == TCL_OK )
4201 string =
argv[idxname + 1];
4202 minlong = atof(
argv[idxname + 2] );
4203 maxlong = atof(
argv[idxname + 3] );
4204 minlat = atof(
argv[idxname + 4] );
4205 maxlat = atof(
argv[idxname + 5] );
4206 if ( entries != NULL )
4208 if ( transform && idxname == 2 )
4215 plmapstring( NULL,
argv[idxname],
string, minlong, maxlong, minlat, maxlat, entries, nentries );
4239 PLFLT minlong, maxlong, minlat, maxlat;
4254 if ( Tcl_GetDouble(
interp,
argv[2], &dminlong ) == TCL_OK )
4278 Tcl_AppendResult(
interp,
"bogus syntax for plmaptex, see doc.",
4283 dx = atof(
argv[idxname + 1] );
4284 dy = atof(
argv[idxname + 2] );
4285 just = atof(
argv[idxname + 3] );
4287 minlong = atof(
argv[idxname + 5] );
4288 maxlong = atof(
argv[idxname + 6] );
4289 minlat = atof(
argv[idxname + 7] );
4290 maxlat = atof(
argv[idxname + 8] );
4291 plotentry = atoi(
argv[idxname + 9] );
4292 if ( transform && idxname == 2 )
4294 plmaptex( &
mapform,
argv[idxname], dx, dy, just,
text, minlong, maxlong, minlat, maxlat, plotentry );
4299 plmaptex( NULL,
argv[idxname], dx, dy, just,
text, minlong, maxlong, minlat, maxlat, plotentry );
4322 PLFLT dlong, dlat, minlong, maxlong, minlat, maxlat;
4329 Tcl_AppendResult(
interp,
"bogus syntax for plmeridians, see doc.",
4338 dlong = atof(
argv[1] );
4339 dlat = atof(
argv[2] );
4340 minlong = atof(
argv[3] );
4341 maxlong = atof(
argv[4] );
4342 minlat = atof(
argv[5] );
4343 maxlat = atof(
argv[6] );
4347 dlong = atof(
argv[2] );
4348 dlat = atof(
argv[3] );
4349 minlong = atof(
argv[4] );
4350 maxlong = atof(
argv[5] );
4351 minlat = atof(
argv[6] );
4352 maxlat = atof(
argv[7] );
4369 plmeridians( NULL, dlong, dlat, minlong, maxlong, minlat, maxlat );
4379#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 5
4380 "set result [%s ${_##_x} ${_##_y}] ; set _##_x [lindex $result 0] ; set _##_y [lindex $result 1]"
4382 "set result [%s ${_##_x} ${_##_y}] ; lassign $result _##_x _##_y"
4391 Tcl_Obj *objx, *objy;
4396 objx = Tcl_NewDoubleObj( (
double) x );
4397 Tcl_IncrRefCount( objx );
4399 "_##_x", NULL, objx, 0 );
4400 Tcl_DecrRefCount( objx );
4403 objy = Tcl_NewDoubleObj( (
double) y );
4404 Tcl_IncrRefCount( objy );
4406 "_##_y", NULL, objy, 0 );
4407 Tcl_DecrRefCount( objy );
4418 if ( code != TCL_OK )
4420 printf(
"Unable to evaluate Tcl-side coordinate transform.\n" );
4421 printf(
"code = %d\n", code );
4434 printf(
"Unable to extract Tcl results.\n" );
4453 || strcmp(
argv[1],
"NULL" ) == 0 )
4490 tclMatrix *arrx, *arry, *arrz, *xcoord, *ycoord, *zvalue;
4491 PLINT pts, nx, ny, alg;
4500 Tcl_AppendResult(
interp,
"wrong # args: see documentation for ",
4501 argv[0], (
char *) NULL );
4511 sscanf(
argv[7],
"%d", &alg );
4515 if ( arrx->
dim != 1 )
4517 Tcl_AppendResult(
interp,
argv[0],
": argument 1 should be a \
4518one-dimensional matrix - ",
argv[1], (
char *) NULL );
4521 if ( arry->
dim != 1 )
4523 Tcl_AppendResult(
interp,
argv[0],
": argument 2 should be a \
4524one-dimensional matrix - ",
argv[2], (
char *) NULL );
4527 if ( arrz->
dim != 1 )
4529 Tcl_AppendResult(
interp,
argv[0],
": argument 3 should be a \
4530one-dimensional matrix - ",
argv[3], (
char *) NULL );
4534 if ( xcoord->
dim != 1 )
4536 Tcl_AppendResult(
interp,
argv[0],
": argument 4 should be a \
4537one-dimensional matrix - ",
argv[4], (
char *) NULL );
4540 if ( ycoord->
dim != 1 )
4542 Tcl_AppendResult(
interp,
argv[0],
": argument 5 should be a \
4543one-dimensional matrix - ",
argv[5], (
char *) NULL );
4546 if ( zvalue->
dim != 2 )
4548 Tcl_AppendResult(
interp,
argv[0],
": argument 6 should be a \
4549two-dimensional matrix - ",
argv[6], (
char *) NULL );
4563 xcoord->
fdata, nx, ycoord->
fdata, ny, z, alg, optalg );
4566 for ( i = 0; i < nx; i++ )
4568 for ( j = 0; j < ny; j++ )
4570 zvalue->
fdata[j + zvalue->
n[1] * i] = z[i][j];
4590 PLFLT xmin, xmax, ymin, ymax, zmin, zmax, Dxmin, Dxmax, Dymin, Dymax;
4597 Tcl_AppendResult(
interp,
"wrong # args: see documentation for ",
4598 argv[0], (
char *) NULL );
4604 if ( zvalue->
dim != 2 )
4606 Tcl_AppendResult(
interp,
argv[0],
": argument 1 should be a \
4607two-dimensional matrix - ",
argv[1], (
char *) NULL );
4627 for ( i = 0; i < nx; i++ )
4629 for ( j = 0; j < ny; j++ )
4631 pidata[i][j] = zvalue->
fdata[j + i * ny];
4643 c_plimage( (
const PLFLT *
const *) pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
4644 Dxmin, Dxmax, Dymin, Dymax );
4669 PLFLT xmin, xmax, ymin, ymax, zmin, zmax, valuemin, valuemax;
4676 Tcl_AppendResult(
interp,
"wrong # args: see documentation for ",
4677 argv[0], (
char *) NULL );
4683 if ( zvalue->
dim != 2 )
4685 Tcl_AppendResult(
interp,
argv[0],
": argument 1 should be a \
4686two-dimensional matrix - ",
argv[1], (
char *) NULL );
4699 Tcl_AppendResult(
interp,
argv[0],
": argument 10 should be a \
4700two-dimensional matrix - ",
argv[10], (
char *) NULL );
4706 Tcl_AppendResult(
interp,
argv[0],
": argument 11 should be a \
4707two-dimensional matrix - ",
argv[11], (
char *) NULL );
4726 for ( i = 0; i < nx; i++ )
4728 for ( j = 0; j < ny; j++ )
4730 pidata[i][j] = zvalue->
fdata[j + i * ny];
4741 for ( i = 0; i <= nx; i++ )
4743 for ( j = 0; j <= ny; j++ )
4745 cgrid2.
xg[i][j] = xg->
fdata[j + i * ( ny + 1 )];
4746 cgrid2.
yg[i][j] =
yg->fdata[j + i * ( ny + 1 )];
4749 c_plimagefr( (
const PLFLT *
const *) pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
4750 valuemin, valuemax,
pltr2, (
void *) &cgrid2 );
4754 c_plimagefr( (
const PLFLT *
const *) pidata, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
4755 valuemin, valuemax, NULL, NULL );
4786 PLFLT xmin, xmax, xjump, ymin, ymax, xlpos, ylpos;
4788 PLINT colbox, collab;
4789 PLINT colline[4], styline[4];
4791 const char **legline;
4799 Tcl_AppendResult(
interp,
"wrong # args: see documentation for ",
4800 argv[0], (
char *) NULL );
4807 if ( colMat->
dim != 1 || colMat->
idata == NULL )
4809 Tcl_AppendResult(
interp,
argv[0],
": argument 15 should be a \
4810one-dimensional integer matrix - ",
argv[15], (
char *) NULL );
4814 if ( styleMat->
dim != 1 || styleMat->
idata == NULL )
4816 Tcl_AppendResult(
interp,
argv[0],
": argument 16 should be a \
4817one-dimensional integer matrix - ",
argv[16], (
char *) NULL );
4832 sscanf(
argv[11],
"%d", &ivalue ); y_ascl = (
PLBOOL) ivalue;
4833 sscanf(
argv[12],
"%d", &ivalue ); acc = (
PLBOOL) ivalue;
4834 sscanf(
argv[13],
"%d", &ivalue ); colbox = ivalue;
4835 sscanf(
argv[14],
"%d", &ivalue ); collab = ivalue;
4841 for ( i = 0; i < 4; i++ )
4843 colline[i] = colMat->
idata[i];
4844 styline[i] = styleMat->
idata[i];
4847 if ( Tcl_SplitList(
interp,
argv[17], &nlegend, &legline ) != TCL_OK )
4853 Tcl_AppendResult(
interp,
argv[0],
": argument 18 should be a \
4854list of at least four items - ",
argv[17], (
char *) NULL );
4859 xmin, xmax, xjump, ymin, ymax,
4863 colline, styline, legline,
4864 labx, laby, labtop );
4866 sprintf( idvalue,
"%d",
id );
4867 Tcl_SetVar(
interp, idName, idvalue, 0 );
4869 Tcl_Free( (
char *) legline );
4905 strncpy(
string,
"ERROR", (
size_t) string_length );
4909 strncpy(
string, Tcl_GetStringResult(
tcl_interp ), (
size_t) string_length );
4931 Tcl_AppendResult(
interp,
"bogus syntax for plslabelfunc, see doc.",
4948 if ( strlen(
argv[1] ) == 0 )
4989 list = Tcl_NewStringObj( list_numbers, ( -1 ) );
4991 retcode = Tcl_ListObjLength(
interp, list, number );
4992 if ( retcode != TCL_OK || ( *number ) == 0 )
4999 array = (
int *) malloc(
sizeof (
int ) * (
size_t) ( *number ) );
5000 for ( i = 0; i < ( *number ); i++ )
5002 Tcl_ListObjIndex(
interp, list, i, &elem );
5003 Tcl_GetIntFromObj(
interp, elem, &array[i] );
5017 list = Tcl_NewStringObj( list_numbers, ( -1 ) );
5019 retcode = Tcl_ListObjLength(
interp, list, number );
5020 if ( retcode != TCL_OK || ( *number ) == 0 )
5027 array = (
PLFLT *) malloc(
sizeof (
PLFLT ) * (
size_t) ( *number ) );
5028 for ( i = 0; i < ( *number ); i++ )
5030 Tcl_ListObjIndex(
interp, list, i, &elem );
5031 Tcl_GetDoubleFromObj(
interp, elem, &ddata );
5032 array[i] = (
PLFLT) ddata;
5048 list = Tcl_NewStringObj( list_strings, ( -1 ) );
5050 retcode = Tcl_ListObjLength(
interp, list, number );
5051 if ( retcode != TCL_OK || ( *number ) == 0 )
5058 array = (
char **) malloc(
sizeof (
char* ) * (
size_t) ( *number ) );
5059 array[0] = (
char *) malloc(
sizeof (
char ) * ( strlen( list_strings ) + 1 ) );
5061 for ( i = 0; i < ( *number ); i++ )
5063 Tcl_ListObjIndex(
interp, list, i, &elem );
5064 string = Tcl_GetStringFromObj( elem, &length );
5066 array[i] = array[0] + idx;
5067 strncpy( array[i],
string, (
size_t) length );
5069 array[0][idx - 1] =
'\0';
5079 PLFLT legend_width, legend_height;
5080 PLFLT x, y, plot_width;
5081 PLINT opt, position;
5082 PLINT bg_color, bb_color, bb_style;
5083 PLINT nrow, ncolumn;
5086 PLFLT text_offset, text_scale, text_spacing, text_justification;
5088 PLINT *box_colors, *box_patterns;
5090 PLINT *line_colors, *line_styles;
5091 PLFLT *box_line_widths, *line_widths;
5092 PLINT *symbol_colors, *symbol_numbers;
5093 PLFLT *symbol_scales;
5106 Tcl_AppendResult(
interp,
"bogus syntax for pllegend, see doc.",
5111 sscanf(
argv[1],
"%d", &opt );
5112 sscanf(
argv[2],
"%d", &position );
5116 sscanf(
argv[6],
"%d", &bg_color );
5117 sscanf(
argv[7],
"%d", &bb_color );
5118 sscanf(
argv[8],
"%d", &bb_style );
5119 sscanf(
argv[9],
"%d", &nrow );
5120 sscanf(
argv[10],
"%d", &ncolumn );
5141 nlegend =
MIN( number_opts, number_texts );
5144 opt, position, x, y, plot_width,
5145 bg_color, bb_color, bb_style,
5148 text_offset, text_scale, text_spacing,
5150 text_colors, (
const char *
const *)
text,
5151 box_colors, box_patterns,
5152 box_scales, box_line_widths,
5153 line_colors, line_styles,
5155 symbol_colors, symbol_scales,
5156 symbol_numbers, (
const char *
const *) symbols );
5158 if ( opt_array != NULL )
5160 if ( text_colors != NULL )
5161 free( text_colors );
5167 if ( box_colors != NULL )
5169 if ( box_patterns != NULL )
5170 free( box_patterns );
5171 if ( box_scales != NULL )
5173 if ( box_line_widths != NULL )
5174 free( box_line_widths );
5175 if ( line_colors != NULL )
5176 free( line_colors );
5177 if ( line_styles != NULL )
5178 free( line_styles );
5179 if ( line_widths != NULL )
5180 free( line_widths );
5181 if ( symbol_colors != NULL )
5182 free( symbol_colors );
5183 if ( symbol_scales != NULL )
5184 free( symbol_scales );
5185 if ( symbol_numbers != NULL )
5186 free( symbol_numbers );
5187 if ( symbols != NULL )
5193 data[0] = Tcl_NewDoubleObj( (
double) legend_width );
5194 data[1] = Tcl_NewDoubleObj( (
double) legend_height );
5195 Tcl_SetObjResult(
interp, Tcl_NewListObj( 2, data ) );
5210 PLFLT colorbar_width, colorbar_height;
5211 PLINT opt, position;
5212 PLFLT x, y, x_length, y_length;
5213 PLINT bg_color, bb_color, bb_style;
5214 PLFLT low_cap_color, high_cap_color;
5228 Tcl_Obj *list_vectors;
5230 PLINT *vector_sizes;
5231 PLFLT **vector_values;
5244 Tcl_AppendResult(
interp,
"bogus syntax for plcolorbar, see doc.",
5250 sscanf(
argv[1],
"%d", &opt );
5251 sscanf(
argv[2],
"%d", &position );
5256 sscanf(
argv[7],
"%d", &bg_color );
5257 sscanf(
argv[8],
"%d", &bb_color );
5258 sscanf(
argv[9],
"%d", &bb_style );
5261 sscanf(
argv[12],
"%d", &cont_color );
5268 list_vectors = Tcl_NewStringObj(
argv[19], ( -1 ) );
5271 if ( n_label_opts != n_labels )
5273 Tcl_AppendResult(
interp,
"number of label options must equal number of labels.",
5277 if ( n_axis_opts != n_ticks || n_axis_opts != n_sub_ticks )
5279 Tcl_AppendResult(
interp,
"number of axis, tick and subtick options must be equal.",
5283 n_axes = n_axis_opts;
5285 retcode = Tcl_ListObjLength(
interp, list_vectors, &n_vectors );
5286 if ( retcode != TCL_OK || n_vectors == 0 )
5288 Tcl_AppendResult(
interp,
"malformed list of vectors or no vector at all.",
5294 vector_sizes = (
int *) malloc(
sizeof (
int ) * (
size_t) n_vectors );
5295 vector_values = (
PLFLT **) malloc(
sizeof (
PLFLT * ) * (
size_t) n_vectors );
5296 for ( i = 0; i < n_vectors; i++ )
5298 Tcl_ListObjIndex(
interp, list_vectors, i, &vector );
5300 if ( vectorPtr->
dim != 1 )
5302 Tcl_AppendResult(
interp,
"element in list of vectors is not a vector.",
5306 vector_sizes[i] = vectorPtr->
n[0];
5307 vector_values[i] = vectorPtr->
fdata;
5312 opt, position, x, y,
5314 bg_color, bb_color, bb_style,
5315 low_cap_color, high_cap_color,
5316 cont_color, cont_width,
5317 n_labels, label_opts, (
const char *
const *) labels,
5318 n_axes, (
const char *
const *) axis_opts,
5320 vector_sizes, (
const PLFLT *
const *) vector_values );
5322 if ( label_opts != NULL )
5324 if ( labels != NULL )
5329 if ( axis_opts != NULL )
5331 free( axis_opts[0] );
5334 if ( ticks != NULL )
5336 if ( sub_ticks != NULL )
5338 if ( vector_values != NULL )
5340 free( vector_sizes );
5341 free( vector_values );
5344 Tcl_DecrRefCount( list_vectors );
5346 data[0] = Tcl_NewDoubleObj( (
double) colorbar_width );
5347 data[1] = Tcl_NewDoubleObj( (
double) colorbar_height );
5348 Tcl_SetObjResult(
interp, Tcl_NewListObj( 2, data ) );
int Matrix_Init(Tcl_Interp *interp)
void pltr2(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data)
void pltr1(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data)
void pltr0(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer PL_UNUSED(pltr_data))
void plsError(PLINT *errcode, char *errmsg)
static PLFLT value(double n1, double n2, double hue)
char PLDLLIMPEXP * plplotLibDir
void plGetName(PLCHAR_VECTOR dir, PLCHAR_VECTOR subdir, PLCHAR_VECTOR filename, char **filespec)
char PLDLLIMPEXP * plstrdup(PLCHAR_VECTOR src)
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)
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)
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)
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 plFree2dGrid(PLFLT **f, PLINT nx, PLINT PL_UNUSED(ny))
void plAlloc2dGrid(PLFLT ***f, PLINT nx, PLINT ny)
#define PLPLOT_IWIDGETS_VERSION
#define PLPLOT_ITCL_VERSION
#define PLPLOT_ITK_VERSION
static const char shade or gradient plots n n or n gradient plots(See pllegend for similar functionality for creating\n\ legends with discrete elements). The arguments of plcolorbar provide\n\ control over the location and size of the color bar as well as the\n\ location and characteristics of the elements(most of which are\n\ optional) within that color bar. The resulting color bar is clipped\n\ at the boundaries of the current subpage.(N.B. the adopted coordinate\n\ system used for some of the parameters is defined in the documentation\n\ of the position parameter.)\n\ \n\ Redacted form reads the desired grid location from the input vectors n xg[nptsx] and yg[nptsy]
static void set_plplot_parameters(Tcl_Interp *interp)
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)
PLDLLIMPEXP_TCLTK int plWait_Until(ClientData, Tcl_Interp *, int, const char **)
int(* proc)(void *, struct Tcl_Interp *, int, const char **)
int(* proc)(void *, struct Tcl_Interp *, int, const char **)
static int plmapstringCmd(ClientData, Tcl_Interp *, int, const char **)
static int plvectCmd(ClientData, Tcl_Interp *, int, const char **)
static int tcl_cmd(Tcl_Interp *interp, const char *cmd)
static void plTclCmd_Init(Tcl_Interp *PL_UNUSED(interp))
static int loopbackCmd(ClientData, Tcl_Interp *, int, const char **)
static int plsurf3dlCmd(ClientData, Tcl_Interp *, int, const char **)
static int plcontCmd(ClientData, Tcl_Interp *, int, const char **)
static const char * tcl_xform_template
static int plmeshcCmd(ClientData, Tcl_Interp *, int, const char **)
static int plranddCmd(ClientData, Tcl_Interp *, int, const char **)
#define CHECK_Tcl_GetMatrixPtr(result, interp, matName)
static int plmapCmd(ClientData, Tcl_Interp *, int, const char **)
static int * argv_to_ints(Tcl_Interp *interp, const char *list_numbers, Tcl_Size *number)
static const char * transform_name
static int plimagefrCmd(ClientData, Tcl_Interp *, int, const char **)
static int plimageCmd(ClientData, Tcl_Interp *, int, const char **)
static Tcl_Interp * tcl_interp
static int plmeshCmd(ClientData, Tcl_Interp *, int, const char **)
static PLFLT * argv_to_PLFLTs(Tcl_Interp *interp, const char *list_numbers, Tcl_Size *number)
static int plmaptexCmd(ClientData, Tcl_Interp *, int, const char **)
static int cmdTable_initted
static char ** argv_to_chars(Tcl_Interp *interp, const char *list_strings, Tcl_Size *number)
static Tcl_Obj * label_objs[4]
static int plsurf3dCmd(ClientData, Tcl_Interp *, int, const char **)
static char * tcl_xform_procname
static int plgriddataCmd(ClientData, Tcl_Interp *, int, const char **)
void mapform(PLINT n, PLFLT *x, PLFLT *y)
static int plot3dCmd(ClientData, Tcl_Interp *, int, const char **)
static int plshadeCmd(ClientData, Tcl_Interp *, int, const char **)
static int * GetEntries(Tcl_Interp *interp, const char *string, Tcl_Size *n)
static int plmeridiansCmd(ClientData, Tcl_Interp *, int, const char **)
PLFLT tclMatrix_feval(PLINT i, PLINT j, PLPointer p)
static int tclmateval_mody
static int plstripcCmd(ClientData, Tcl_Interp *, int, const char **)
static int plslabelfuncCmd(ClientData, Tcl_Interp *, int, const char **)
static int plmapfillCmd(ClientData, Tcl_Interp *, int, const char **)
void labelform(PLINT axis, PLFLT value, char *string, PLINT string_length, PLPointer data)
static int plsvectCmd(ClientData, Tcl_Interp *, int, const char **)
int Pltcl_Init(Tcl_Interp *interp)
static int tclmateval_modx
int pls_auto_path(Tcl_Interp *interp)
static void Tcl_transform(PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer PL_UNUSED(data))
static char * tcl_xform_code
static void Append_Cmdlist(Tcl_Interp *interp)
static int plstransformCmd(ClientData, Tcl_Interp *, int, const char **)
static int plsetoptCmd(ClientData, Tcl_Interp *, int, const char **)
int PlbasicInit(Tcl_Interp *interp)
static int pllegendCmd(ClientData, Tcl_Interp *, int, const char **)
static int plmaplineCmd(ClientData, Tcl_Interp *, int, const char **)
static int plot3dcCmd(ClientData, Tcl_Interp *, int, const char **)
int plTclCmd(char *cmdlist, Tcl_Interp *interp, int argc, const char **argv)
static int plcolorbarCmd(ClientData, Tcl_Interp *, int, const char **)
static int plshadesCmd(ClientData, Tcl_Interp *, int, const char **)
static Tcl_Interp * tcl_xform_interp
int plWait_Until(ClientData PL_UNUSED(clientData), Tcl_Interp *interp, int PL_UNUSED(argc), const char **argv)
static Tcl_HashTable cmdTable
tclMatrix * Tcl_GetMatrixPtr(Tcl_Interp *interp, const char *matName)
static Tcl_Interp * interp