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

Plplotter_Init.c

Go to the documentation of this file.
00001 // $Id: Plplotter_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 // This file is derived from the old tkshell.c, and implements the Pltk init
00022 // function.  It can be loaded into any Tcl7.5 interpreter, and requires some
00023 // .tcl library files to be in known places.  Set your environment variables
00024 // to make sure of this.
00025 //
00026 // Old changes see 'tkshell.c'.  This file should be used _instead_ of
00027 // tkshell.c, if building the 'libPltk.so' shared library for dynamic loading
00028 // into Tcl.
00029 //
00030 
00031 //
00032 // tkshell.c
00033 // Maurice LeBrun
00034 // 6-May-93
00035 //
00036 // A miscellaneous assortment of Tcl support functions.
00037 //
00038 
00039 #include "plserver.h"
00040 
00041 #ifdef BUILD_Plplot
00042 #undef TCL_STORAGE_CLASS
00043 #define TCL_STORAGE_CLASS    DLLEXPORT
00044 #endif // BUILD_Vfs
00045 
00046 //--------------------------------------------------------------------------
00047 // Plplotter_Init
00048 //
00049 // Initialization routine for extended wish'es.
00050 // Creates the plframe, wait_until, and host_id (w/Tcl-DP only)
00051 // commands.  The more basic Plplot-Tcl initialization is handled by
00052 // the Plbasicinit function called from here.
00053 //--------------------------------------------------------------------------
00054 
00055 EXTERN int
00056 Plplotter_Init( Tcl_Interp *interp )
00057 {
00058 #ifdef USE_TCL_STUBS
00059     //
00060     // We hard-wire 8.1 here, rather than TCL_VERSION, TK_VERSION because
00061     // we really don't mind which version of Tcl, Tk we use as long as it
00062     // is 8.1 or newer.  Otherwise if we compiled against 8.2, we couldn't
00063     // be loaded into 8.1
00064     //
00065     Tcl_InitStubs( interp, "8.1", 0 );
00066 #endif
00067 #ifdef USE_TK_STUBS
00068     Tk_InitStubs( interp, "8.1", 0 );
00069 #endif
00070     // This must be before any other Tcl related calls
00071     if ( PlbasicInit( interp ) != TCL_OK )
00072     {
00073         return TCL_ERROR;
00074     }
00075 
00076     //
00077     // Note, the old technique of:
00078     //    main = Tk_MainWindow(interp);
00079     // and then passing main to 'plframe' as the clientdata can
00080     // cause unusual problems, probably due to bugs in Tk on
00081     // some platforms, when the 'main window' doesn't yet exist
00082     // properly by the time we are called.  Since plframe only
00083     // uses the value in one place (each time a new frame is
00084     // created), we simply use 'Tk_MainWindow' in plframe, and
00085     // avoid the startup problems.
00086     //
00087 
00088 // plframe -- PLplot graphing widget
00089 
00090     Tcl_CreateCommand( interp, "plframe", (Tcl_CmdProc *) plPlotterCmd,
00091         (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );
00092 
00093     Tcl_PkgProvide( interp, "Plplotter", VERSION );
00094     return TCL_OK;
00095 }
00096 

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