55 {
"-client_name", TK_ARGV_STRING, (
char *) NULL, (
char *) &
client_name,
56 "Client main window name to connect to" },
57 {
"-client_host", TK_ARGV_STRING, (
char *) NULL, (
char *) &
client_host,
58 "Client host to connect to" },
59 {
"-client_port", TK_ARGV_STRING, (
char *) NULL, (
char *) &
client_port,
60 "Client port (Tcl-DP) to connect to" },
61 {
"-auto_path", TK_ARGV_STRING, (
char *) NULL, (
char *) &
auto_path,
62 "Additional directory(s) to autoload" },
63 {
"-child", TK_ARGV_CONSTANT, (
char *) 1, (
char *) &
child,
64 "Set ONLY when child of PLplot TK driver" },
65 { (
char *) NULL, TK_ARGV_END, (
char *) NULL, (
char *) NULL,
101 const char *helpmsg =
"Command-specific options:";
104 fprintf( stderr,
"Program %s called with arguments :\n", argv[0] );
105 for ( i = 1; i <
argc; i++ )
107 fprintf( stderr,
"%s ", argv[i] );
109 fprintf( stderr,
"\n" );
114 interp = Tcl_CreateInterp();
119 fprintf( stderr,
"Before myargv\n" );
122 myargv = (
const char **) malloc( argc *
sizeof (
char * ) );
123 for ( i = 0; i <
argc; i++ )
129 fprintf( stderr,
"After myargv\n" );
135 if ( Tk_ParseArgv( interp, (Tk_Window) NULL, &argc, argv,
136 argTable, TK_ARGV_NO_DEFAULTS ) != TCL_OK )
138 fprintf( stderr,
"Error in Tk_ParseArgv\n" );
139 fprintf( stderr,
"\n(plserver) %s\n\n", Tcl_GetStringResult( interp ) );
141 The client_<xxx> and -child options should not be used except via the\n\
142 PLplot/Tk driver.\n\n(wish) " );
143 fprintf( stderr,
"Before Tcl_SetResult\n" );
144 Tcl_SetResult( interp, (
char *) helpmsg, TCL_VOLATILE );
148 fprintf( stderr,
"After Tk_ParseArgv\n" );
153 #if TCL_MAJOR_VERSION < 7 || ( TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION < 5 )
154 Tcl_DeleteInterp( interp );
186 Tk_Window mainWindow = Tk_MainWindow( interp );
208 Tcl_SetVar( interp,
"child",
"1", 0 );
216 Tcl_SetVar( interp,
"client_name",
client_name, 0 );
225 Tcl_SetVar( interp,
"client_port",
client_port, 0 );
227 Tcl_SetVar( interp,
"client_host",
client_host, 0 );
228 dp = 1;
tcl_cmd( interp,
"set dp 1" );
230 Tcl_AppendResult( interp,
231 "no Tcl-DP support in this version of plserver",
241 Tcl_SetVar( interp,
"dir",
auto_path, 0 );
242 tcl_cmd( interp,
"lappend auto_path $dir" );
247 tcl_cmd( interp,
"rename exit tkexit" );
249 Tcl_CreateCommand( interp,
"exit", (Tcl_CmdProc *)
plExitCmd,
250 (ClientData) mainWindow, (Tcl_CmdDeleteProc *) NULL );
271 res = Tcl_GetStringResult( interp );
272 if ( res[0] !=
'\0' )
273 fprintf( stderr,
"%s\n", res );
277 if ( ( argc != 1 ) && ( argc != 2 ) )
279 Tcl_AppendResult( interp,
"wrong # args: should be \"", argv[0],
280 " ?returnCode?\"", (
char *) NULL );
283 if ( ( argc != 1 ) && ( Tcl_GetInt( interp, argv[1], &value ) != TCL_OK ) )
285 Tcl_AppendResult( interp,
"non-integer return code: \"", argv[1],
286 "\"", (
char *) NULL );
292 Tcl_VarEval( interp,
"plserver_link_end", (
char **) NULL );
300 return Tcl_VarEval( interp,
"tkexit", (
char **) NULL );
304 return Tcl_VarEval( interp,
"tkexit", argv[1], (
char **) NULL );
320 pldebug(
"tcl_cmd",
"evaluating command %s\n", cmd );
322 result = Tcl_VarEval( interp, cmd, (
char **) NULL );
323 if ( result != TCL_OK )
325 Tcl_Eval( interp,
"exit" );