53 {
"-client_name", TK_ARGV_STRING, (
char *) NULL, (
char *) &
client_name,
54 "Client main window name to connect to" },
55 {
"-client_host", TK_ARGV_STRING, (
char *) NULL, (
char *) &
client_host,
56 "Client host to connect to" },
57 {
"-client_port", TK_ARGV_STRING, (
char *) NULL, (
char *) &
client_port,
58 "Client port (Tcl-DP) to connect to" },
59 {
"-auto_path", TK_ARGV_STRING, (
char *) NULL, (
char *) &
auto_path,
60 "Additional directory(s) to autoload" },
61 {
"-child", TK_ARGV_CONSTANT, (
char *) 1, (
char *) &
child,
62 "Set ONLY when child of PLplot TK driver" },
63 { (
char *) NULL, TK_ARGV_END, (
char *) NULL, (
char *) NULL,
99 const char *helpmsg =
"Command-specific options:";
102 fprintf( stderr,
"Program %s called with arguments :\n", argv[0] );
103 for ( i = 1; i <
argc; i++ )
105 fprintf( stderr,
"%s ", argv[i] );
107 fprintf( stderr,
"\n" );
112 interp = Tcl_CreateInterp();
117 fprintf( stderr,
"Before myargv\n" );
123 myargv = (
const char **) malloc( ( argc + 1 ) *
sizeof (
char * ) );
124 for ( i = 0; i < argc + 1; i++ )
130 fprintf( stderr,
"After myargv\n" );
136 if ( Tk_ParseArgv( interp, (Tk_Window) NULL, &argc, argv,
137 argTable, TK_ARGV_NO_DEFAULTS ) != TCL_OK )
140 fprintf( stderr,
"Error in Tk_ParseArgv\n" );
142 fprintf( stderr,
"\n(plserver) %s\n\n", Tcl_GetStringResult( interp ) );
144 The client_<xxx> and -child options should not be used except via the\n\
145 PLplot/Tk driver.\n\n(wish) " );
147 fprintf( stderr,
"Before Tcl_SetResult\n" );
149 Tcl_SetResult( interp, (
char *) helpmsg, TCL_VOLATILE );
153 fprintf( stderr,
"After Tk_ParseArgv\n" );
158 #if TCL_MAJOR_VERSION < 7 || ( TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION < 5 )
159 Tcl_DeleteInterp( interp );
191 Tk_Window mainWindow = Tk_MainWindow( interp );
213 Tcl_SetVar( interp,
"child",
"1", 0 );
221 Tcl_SetVar( interp,
"client_name",
client_name, 0 );
230 Tcl_SetVar( interp,
"client_port",
client_port, 0 );
232 Tcl_SetVar( interp,
"client_host",
client_host, 0 );
233 dp = 1;
tcl_cmd( interp,
"set dp 1" );
235 Tcl_AppendResult( interp,
236 "no Tcl-DP support in this version of plserver",
246 Tcl_SetVar( interp,
"dir",
auto_path, 0 );
247 tcl_cmd( interp,
"lappend auto_path $dir" );
252 tcl_cmd( interp,
"rename exit tkexit" );
254 Tcl_CreateCommand( interp,
"exit", (Tcl_CmdProc *)
plExitCmd,
255 (ClientData) mainWindow, (Tcl_CmdDeleteProc *) NULL );
276 res = Tcl_GetStringResult( interp );
277 if ( res[0] !=
'\0' )
278 fprintf( stderr,
"%s\n", res );
282 if ( ( argc != 1 ) && ( argc != 2 ) )
284 Tcl_AppendResult( interp,
"wrong # args: should be \"", argv[0],
285 " ?returnCode?\"", (
char *) NULL );
288 if ( ( argc != 1 ) && ( Tcl_GetInt( interp, argv[1], &value ) != TCL_OK ) )
290 Tcl_AppendResult( interp,
"non-integer return code: \"", argv[1],
291 "\"", (
char *) NULL );
297 Tcl_VarEval( interp,
"plserver_link_end", (
char **) NULL );
305 return Tcl_VarEval( interp,
"tkexit", (
char **) NULL );
309 return Tcl_VarEval( interp,
"tkexit", argv[1], (
char **) NULL );
325 pldebug(
"tcl_cmd",
"evaluating command %s\n", cmd );
327 result = Tcl_VarEval( interp, cmd, (
char **) NULL );
328 if ( result != TCL_OK )
330 Tcl_Eval( interp,
"exit" );
static void tcl_cmd(Tcl_Interp *interp, const char *cmd)
int main(int argc, const char **argv)
static int plExitCmd(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
static Tk_ArgvInfo argTable[]
EXTERN PLDLLIMPEXP_TCLTK int pltkMain(int argc, const char **argv, char *RcFileName, int(*AppInit)(Tcl_Interp *interp))
static char * client_port
static char * client_host
static char * client_name
static PLFLT value(double n1, double n2, double hue)
EXTERN PLDLLIMPEXP_TCLTK int Pltk_Init(Tcl_Interp *interp)
static Tcl_Interp * interp
static int AppInit(Tcl_Interp *interp)