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 // 00020 // This file is derived from the old tkshell.c, and implements the Pltk init 00021 // function. It can be loaded into any Tcl7.5 interpreter, and requires some 00022 // .tcl library files to be in known places. Set your environment variables 00023 // to make sure of this. 00024 // 00025 // Old changes see 'tkshell.c'. This file should be used _instead_ of 00026 // tkshell.c, if building the 'libPltk.so' shared library for dynamic loading 00027 // into Tcl. 00028 // 00029 00030 // 00031 // tkshell.c 00032 // Maurice LeBrun 00033 // 6-May-93 00034 // 00035 // A miscellaneous assortment of Tcl support functions. 00036 // 00037 00038 #include "plserver.h" 00039 00040 extern int Matrix_Init( Tcl_Interp* interp ); 00041 00042 //-------------------------------------------------------------------------- 00043 // Pltk_Init 00044 // 00045 // Initialization routine for extended wish'es. 00046 // Creates the plframe, matrix, and host_id (w/Tcl-DP only) 00047 // commands. Also sets the auto_path variable. 00048 //-------------------------------------------------------------------------- 00049 00050 int 00051 Pltk_Init( Tcl_Interp *interp ) 00052 { 00053 // This must be before any other Tcl related calls 00054 if ( PlbasicInit( interp ) != TCL_OK ) 00055 { 00056 return TCL_ERROR; 00057 } 00058 00059 #ifdef USE_TK_STUBS 00060 // 00061 // We hard-wire 8.1 here, rather than TCL_VERSION, TK_VERSION because 00062 // we really don't mind which version of Tcl, Tk we use as long as it 00063 // is 8.1 or newer. Otherwise if we compiled against 8.2, we couldn't 00064 // be loaded into 8.1 00065 // 00066 Tk_InitStubs( interp, "8.1", 0 ); 00067 #endif 00068 00069 // plframe -- PLplot graphing widget 00070 00071 Tcl_CreateCommand( interp, "plframe", (Tcl_CmdProc *) plFrameCmd, 00072 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL ); 00073 00074 // host_id -- returns host IP number. Only for use with Tcl-DP 00075 00076 #ifdef PLD_dp 00077 Tcl_CreateCommand( interp, "host_id", (Tcl_CmdProc *) plHost_ID, 00078 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL ); 00079 #endif 00080 00081 // Set up auto_path 00082 00083 if ( pls_auto_path( interp ) == TCL_ERROR ) 00084 return TCL_ERROR; 00085 00086 // Save initial RGB colormap components 00087 // Disabled for now 00088 00089 #if 0 00090 { 00091 Display *display; 00092 Colormap map; 00093 00094 display = Tk_Display( mainWindow ); 00095 map = DefaultColormap( display, DefaultScreen( display ) ); 00096 00097 // Convert this to use esc function if it's going to be used 00098 // SaveColormap(display, map); 00099 } 00100 #endif 00101 00102 Tcl_PkgProvide( interp, "Pltk", PLPLOT_VERSION ); 00103 00104 return TCL_OK; 00105 }