• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Pltk_Init.c

Go to the documentation of this file.
00001 // $Id: Pltk_Init.c 11760 2011-06-01 19:29:11Z airwin $
00002 //
00003 // Copyright (C) 2004  Joao Cardoso
00004 //
00005 // This file is part of PLplot.
00006 //
00007 // PLplot is free software; you can redistribute it and/or modify
00008 // it under the terms of the GNU Library General Public License as published
00009 // by the Free Software Foundation; either version 2 of the License, or
00010 // (at your option) any later version.
00011 //
00012 // PLplot is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU Library General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU Library General Public License
00018 // along with PLplot; if not, write to the Free Software
00019 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020 //
00021 //
00022 // This file is derived from the old tkshell.c, and implements the Pltk init
00023 // function.  It can be loaded into any Tcl7.5 interpreter, and requires some
00024 // .tcl library files to be in known places.  Set your environment variables
00025 // to make sure of this.
00026 //
00027 // Old changes see 'tkshell.c'.  This file should be used _instead_ of
00028 // tkshell.c, if building the 'libPltk.so' shared library for dynamic loading
00029 // into Tcl.
00030 //
00031 
00032 //
00033 // tkshell.c
00034 // Maurice LeBrun
00035 // 6-May-93
00036 //
00037 // A miscellaneous assortment of Tcl support functions.
00038 //
00039 
00040 #include "plserver.h"
00041 
00042 extern int Matrix_Init( Tcl_Interp* interp );
00043 
00044 //--------------------------------------------------------------------------
00045 // Pltk_Init
00046 //
00047 // Initialization routine for extended wish'es.
00048 // Creates the plframe, matrix, and host_id (w/Tcl-DP only)
00049 // commands.  Also sets the auto_path variable.
00050 //--------------------------------------------------------------------------
00051 
00052 int
00053 Pltk_Init( Tcl_Interp *interp )
00054 {
00055     // This must be before any other Tcl related calls
00056     if ( PlbasicInit( interp ) != TCL_OK )
00057     {
00058         return TCL_ERROR;
00059     }
00060 
00061 #ifdef USE_TK_STUBS
00062     //
00063     // We hard-wire 8.1 here, rather than TCL_VERSION, TK_VERSION because
00064     // we really don't mind which version of Tcl, Tk we use as long as it
00065     // is 8.1 or newer.  Otherwise if we compiled against 8.2, we couldn't
00066     // be loaded into 8.1
00067     //
00068     Tk_InitStubs( interp, "8.1", 0 );
00069 #endif
00070 
00071 // plframe -- PLplot graphing widget
00072 
00073     Tcl_CreateCommand( interp, "plframe", (Tcl_CmdProc *) plFrameCmd,
00074         (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
00075 
00076 // host_id -- returns host IP number.  Only for use with Tcl-DP
00077 
00078 #ifdef PLD_dp
00079     Tcl_CreateCommand( interp, "host_id", (Tcl_CmdProc *) plHost_ID,
00080         (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
00081 #endif
00082 
00083 // Set up auto_path
00084 
00085     if ( pls_auto_path( interp ) == TCL_ERROR )
00086         return TCL_ERROR;
00087 
00088 // Save initial RGB colormap components
00089 // Disabled for now
00090 
00091 #if 0
00092     {
00093         Display  *display;
00094         Colormap map;
00095 
00096         display = Tk_Display( mainWindow );
00097         map     = DefaultColormap( display, DefaultScreen( display ) );
00098 
00099 // Convert this to use esc function if it's going to be used
00100 // SaveColormap(display, map);
00101     }
00102 #endif
00103 
00104     Tcl_PkgProvide( interp, "Pltk", VERSION );
00105 
00106     return TCL_OK;
00107 }

Generated on Wed Oct 12 2011 20:42:23 for PLplot by  doxygen 1.7.1