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