File: Plplotter_Init.c

package info (click to toggle)
plplot 5.14.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 30,424 kB
  • sloc: ansic: 79,613; xml: 28,583; cpp: 20,037; ada: 19,456; tcl: 12,081; f90: 11,423; ml: 7,276; java: 6,863; python: 6,792; sh: 3,185; perl: 828; lisp: 75; makefile: 48; sed: 33; fortran: 5
file content (92 lines) | stat: -rw-r--r-- 3,203 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Copyright (C) 2004  Joao Cardoso
//
// This file is part of PLplot.
//
// PLplot is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as published
// by the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// PLplot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with PLplot; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// This file is derived from the old tkshell.c, and implements the Pltk init
// function.  It can be loaded into any Tcl7.5 interpreter, and requires some
// .tcl library files to be in known places.  Set your environment variables
// to make sure of this.
//
// Old changes see 'tkshell.c'.  This file should be used _instead_ of
// tkshell.c, if building the 'libPltk.so' shared library for dynamic loading
// into Tcl.
//

//
// tkshell.c
// Maurice LeBrun
// 6-May-93
//
// A miscellaneous assortment of Tcl support functions.
//

#include "plserver.h"

#ifdef BUILD_Plplot
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS    DLLEXPORT
#endif // BUILD_Vfs

//--------------------------------------------------------------------------
// Plplotter_Init
//
// Initialization routine for extended wish'es.
// Creates the plframe, wait_until, and host_id (w/Tcl-DP only)
// commands.  The more basic Plplot-Tcl initialization is handled by
// the Plbasicinit function called from here.
//--------------------------------------------------------------------------

PLDLLIMPEXP_DRIVER EXTERN int
Plplotter_Init( Tcl_Interp *interp )
{
    // This must be before any other Tcl related calls
    if ( PlbasicInit( interp ) != TCL_OK )
    {
        return TCL_ERROR;
    }

#ifdef USE_TK_STUBS
    //
    // We hard-wire 8.1 here (as is done for the USE_TCL_STUBS case in
    // PlbasisInit above) rather than TK_VERSION because we really don't
    // mind which version of Tcl, Tk we use as long as it is 8.1 or
    // newer.  Otherwise if we compiled against 8.2, we couldn't be
    // loaded into 8.1
    //
    Tk_InitStubs( interp, "8.1", 0 );
#endif
    //
    // Note, the old technique of:
    //    main = Tk_MainWindow(interp);
    // and then passing main to 'plframe' as the clientdata can
    // cause unusual problems, probably due to bugs in Tk on
    // some platforms, when the 'main window' doesn't yet exist
    // properly by the time we are called.  Since plframe only
    // uses the value in one place (each time a new frame is
    // created), we simply use 'Tk_MainWindow' in plframe, and
    // avoid the startup problems.
    //

// plframe -- PLplot graphing widget

    Tcl_CreateCommand( interp, "plframe", (Tcl_CmdProc *) plPlotterCmd,
        (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );

    Tcl_PkgProvide( interp, "Plplotter", PLPLOT_VERSION );
    return TCL_OK;
}