PLplot
5.15.0
tkshell.c
Go to the documentation of this file.
1
// Maurice LeBrun
2
// 6-May-93
3
//
4
// A miscellaneous assortment of Tcl support functions.
5
//
6
//
7
// Copyright (C) 2004 Joao Cardoso
8
//
9
// This file is part of PLplot.
10
//
11
// PLplot is free software; you can redistribute it and/or modify
12
// it under the terms of the GNU Library General Public License as published
13
// by the Free Software Foundation; either version 2 of the License, or
14
// (at your option) any later version.
15
//
16
// PLplot is distributed in the hope that it will be useful,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
// GNU Library General Public License for more details.
20
//
21
// You should have received a copy of the GNU Library General Public License
22
// along with PLplot; if not, write to the Free Software
23
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24
//
25
26
#include "
plserver.h
"
27
28
//--------------------------------------------------------------------------
29
// Pltk_Init
30
//
31
// Initialization routine for extended wish'es.
32
// Creates the plframe, matrix, wait_until, and host_id (w/Tcl-DP only)
33
// commands. Also sets the auto_path variable.
34
//--------------------------------------------------------------------------
35
36
int
37
Pltk_Init
( Tcl_Interp *
interp
)
38
{
39
Tk_Window
main
;
40
41
main
= Tk_MainWindow(
interp
);
42
43
// plframe -- PLplot graphing widget
44
45
Tcl_CreateCommand(
interp
,
"plframe"
, (Tcl_CmdProc *)
plFrameCmd
,
46
(ClientData)
main
, (Tcl_CmdDeleteProc *) NULL );
47
48
// matrix -- matrix support command
49
50
Tcl_CreateCommand(
interp
,
"matrix"
, (Tcl_CmdProc *)
Tcl_MatrixCmd
,
51
(ClientData)
main
, (Tcl_CmdDeleteProc *) NULL );
52
53
// wait_until -- waits for a specific condition to arise
54
// Can be used with either Tcl-DP or TK
55
56
Tcl_CreateCommand(
interp
,
"wait_until"
, (Tcl_CmdProc *)
plWait_Until
,
57
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
58
59
// host_id -- returns host IP number. Only for use with Tcl-DP
60
61
#ifdef PLD_dp
62
Tcl_CreateCommand(
interp
,
"host_id"
, (Tcl_CmdProc *)
plHost_ID
,
63
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
64
#endif
65
66
// Set up auto_path
67
68
if
(
pls_auto_path
(
interp
) == TCL_ERROR )
69
return
TCL_ERROR;
70
71
// Save initial RGB colormap components
72
// Disabled for now
73
74
#if 0
75
{
76
Display *
display
;
77
Colormap map;
78
79
display
= Tk_Display(
main
);
80
map = DefaultColormap(
display
, DefaultScreen(
display
) );
81
82
// Convert this to use esc function if it's going to be used
83
// SaveColormap(display, map);
84
}
85
#endif
86
return
TCL_OK;
87
}
88
89
//--------------------------------------------------------------------------
90
// plWait_Until
91
//
92
// Tcl command -- wait until the specified condition is satisfied.
93
// Processes all events while waiting.
94
//
95
// This command is more capable than tkwait, and has the added benefit
96
// of working with Tcl-DP as well. Example usage:
97
//
98
// wait_until {[info exists foobar]}
99
//
100
// Note the [info ...] command must be protected by braces so that it
101
// isn't actually evaluated until passed into this routine.
102
//--------------------------------------------------------------------------
103
104
int
105
plWait_Until
( ClientData clientData, Tcl_Interp *
interp
,
int
argc
,
char
**
argv
)
106
{
107
int
result = 0;
108
109
dbug_enter
(
"plWait_Until"
);
110
111
for
(;; )
112
{
113
if
( Tcl_ExprBoolean(
interp
,
argv
[1], &result ) )
114
{
115
fprintf( stderr,
"wait_until command \"%s\" failed:\n\t %s\n"
,
116
argv
[1], Tcl_GetStringResult(
interp
) );
117
break
;
118
}
119
if
( result )
120
break
;
121
122
Tk_DoOneEvent( 0 );
123
}
124
return
TCL_OK;
125
}
plFrameCmd
int plFrameCmd(ClientData, Tcl_Interp *, int, const char **)
argc
static int argc
Definition:
qt.cpp:48
plserver.h
main
int main()
Definition:
cdexpert.c:35
Pltk_Init
int Pltk_Init(Tcl_Interp *interp)
Definition:
tkshell.c:37
pls_auto_path
PLDLLIMPEXP_TCLTK int pls_auto_path(Tcl_Interp *interp)
Definition:
tclAPI.c:716
argv
static char ** argv
Definition:
qt.cpp:49
interp
static Tcl_Interp * interp
Definition:
tkMain.c:120
plWait_Until
int plWait_Until(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
Definition:
tkshell.c:105
dbug_enter
#define dbug_enter(a)
Definition:
tclMatrix.c:59
display
static const char * display
Definition:
tkMain.c:136
Tcl_MatrixCmd
int Tcl_MatrixCmd(ClientData PL_UNUSED(clientData), Tcl_Interp *interp, int argc, const char **argv)
Definition:
tclMatrix.c:122
plHost_ID
int plHost_ID(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv)
bindings
tk
tkshell.c
Generated on Thu Nov 7 2019 00:00:00 for PLplot by
1.8.16