PLplot
5.10.0
|
00001 // Copyright (C) 2004 Joao Cardoso 00002 // 00003 // This file is part of PLplot. 00004 // 00005 // PLplot is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU Library General Public License as published 00007 // by the Free Software Foundation; either version 2 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // PLplot is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU Library General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Library General Public License 00016 // along with PLplot; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 // 00019 // This file is derived from the old tkshell.c, and implements the Pltk init 00020 // function. It can be loaded into any Tcl7.5 interpreter, and requires some 00021 // .tcl library files to be in known places. Set your environment variables 00022 // to make sure of this. 00023 // 00024 // Old changes see 'tkshell.c'. This file should be used _instead_ of 00025 // tkshell.c, if building the 'libPltk.so' shared library for dynamic loading 00026 // into Tcl. 00027 // 00028 00029 // 00030 // tkshell.c 00031 // Maurice LeBrun 00032 // 6-May-93 00033 // 00034 // A miscellaneous assortment of Tcl support functions. 00035 // 00036 00037 #include "plserver.h" 00038 00039 #ifdef BUILD_Plplot 00040 #undef TCL_STORAGE_CLASS 00041 #define TCL_STORAGE_CLASS DLLEXPORT 00042 #endif // BUILD_Vfs 00043 00044 //-------------------------------------------------------------------------- 00045 // Plplotter_Init 00046 // 00047 // Initialization routine for extended wish'es. 00048 // Creates the plframe, wait_until, and host_id (w/Tcl-DP only) 00049 // commands. The more basic Plplot-Tcl initialization is handled by 00050 // the Plbasicinit function called from here. 00051 //-------------------------------------------------------------------------- 00052 00053 PLDLLIMPEXP_DRIVER EXTERN int 00054 Plplotter_Init( Tcl_Interp *interp ) 00055 { 00056 // This must be before any other Tcl related calls 00057 if ( PlbasicInit( interp ) != TCL_OK ) 00058 { 00059 return TCL_ERROR; 00060 } 00061 00062 #ifdef USE_TK_STUBS 00063 // 00064 // We hard-wire 8.1 here (as is done for the USE_TCL_STUBS case in 00065 // PlbasisInit above) rather than TK_VERSION because we really don't 00066 // mind which version of Tcl, Tk we use as long as it is 8.1 or 00067 // newer. Otherwise if we compiled against 8.2, we couldn't be 00068 // loaded into 8.1 00069 // 00070 Tk_InitStubs( interp, "8.1", 0 ); 00071 #endif 00072 // 00073 // Note, the old technique of: 00074 // main = Tk_MainWindow(interp); 00075 // and then passing main to 'plframe' as the clientdata can 00076 // cause unusual problems, probably due to bugs in Tk on 00077 // some platforms, when the 'main window' doesn't yet exist 00078 // properly by the time we are called. Since plframe only 00079 // uses the value in one place (each time a new frame is 00080 // created), we simply use 'Tk_MainWindow' in plframe, and 00081 // avoid the startup problems. 00082 // 00083 00084 // plframe -- PLplot graphing widget 00085 00086 Tcl_CreateCommand( interp, "plframe", (Tcl_CmdProc *) plPlotterCmd, 00087 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL ); 00088 00089 Tcl_PkgProvide( interp, "Plplotter", PLPLOT_VERSION ); 00090 return TCL_OK; 00091 } 00092