PLplot: Plplotter_Init.c Source File

PLplot 5.15.0

Plplotter_Init.c
Go to the documentation of this file.
1 // Copyright (C) 2004 Joao Cardoso
2 //
3 // This file is part of PLplot.
4 //
5 // PLplot is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Library General Public License as published
7 // by the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // PLplot is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Library General Public License for more details.
14 //
15 // You should have received a copy of the GNU Library General Public License
16 // along with PLplot; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 // This file is derived from the old tkshell.c, and implements the Pltk init
20 // function. It can be loaded into any Tcl7.5 interpreter, and requires some
21 // .tcl library files to be in known places. Set your environment variables
22 // to make sure of this.
23 //
24 // Old changes see 'tkshell.c'. This file should be used _instead_ of
25 // tkshell.c, if building the 'libPltk.so' shared library for dynamic loading
26 // into Tcl.
27 //
28
29 //
30 // tkshell.c
31 // Maurice LeBrun
32 // 6-May-93
33 //
34 // A miscellaneous assortment of Tcl support functions.
35 //
36
37 #include "plserver.h"
38
39 #ifdef BUILD_Plplot
40 #undef TCL_STORAGE_CLASS
41 #define TCL_STORAGE_CLASS DLLEXPORT
42 #endif // BUILD_Vfs
43
44 //--------------------------------------------------------------------------
45 // Plplotter_Init
46 //
47 // Initialization routine for extended wish'es.
48 // Creates the plframe, wait_until, and host_id (w/Tcl-DP only)
49 // commands. The more basic Plplot-Tcl initialization is handled by
50 // the Plbasicinit function called from here.
51 //--------------------------------------------------------------------------
52
53 PLDLLIMPEXP_DRIVER EXTERN int
54 Plplotter_Init( Tcl_Interp *interp )
55 {
56 // This must be before any other Tcl related calls
57 if ( PlbasicInit( interp ) != TCL_OK )
58 {
59 return TCL_ERROR;
60 }
61
62 #ifdef USE_TK_STUBS
63 //
64 // We hard-wire 8.1 here (as is done for the USE_TCL_STUBS case in
65 // PlbasisInit above) rather than TK_VERSION because we really don't
66 // mind which version of Tcl, Tk we use as long as it is 8.1 or
67 // newer. Otherwise if we compiled against 8.2, we couldn't be
68 // loaded into 8.1
69 //
70 Tk_InitStubs( interp, "8.1", 0 );
71 #endif
72 //
73 // Note, the old technique of:
74 // main = Tk_MainWindow(interp);
75 // and then passing main to 'plframe' as the clientdata can
76 // cause unusual problems, probably due to bugs in Tk on
77 // some platforms, when the 'main window' doesn't yet exist
78 // properly by the time we are called. Since plframe only
79 // uses the value in one place (each time a new frame is
80 // created), we simply use 'Tk_MainWindow' in plframe, and
81 // avoid the startup problems.
82 //
83
84 // plframe -- PLplot graphing widget
85
86 Tcl_CreateCommand( interp, "plframe", (Tcl_CmdProc *) plPlotterCmd,
87 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
88
89 Tcl_PkgProvide( interp, "Plplotter", PLPLOT_VERSION );
90 return TCL_OK;
91 }
92
plPlotterCmd
int plPlotterCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv)
Plplotter_Init
PLDLLIMPEXP_DRIVER EXTERN int Plplotter_Init(Tcl_Interp *interp)
Definition: Plplotter_Init.c:54
PLDLLIMPEXP_DRIVER
#define PLDLLIMPEXP_DRIVER
Definition: pldll.h:81
plserver.h
PLPLOT_VERSION
#define PLPLOT_VERSION
Definition: plConfig.h:54
PlbasicInit
PLDLLIMPEXP_TCLTK int PlbasicInit(Tcl_Interp *interp)
Definition: tclAPI.c:418
interp
static Tcl_Interp * interp
Definition: tkMain.c:120