VTK
dox/Wrapping/Tcl/vtkTclUtil.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkTclUtil.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 
00016 #ifndef __vtkTclInclude_h
00017 #define __vtkTclInclude_h
00018 
00019 #include "vtkObject.h"
00020 #include "vtkCommand.h"
00021 #include "vtkTcl.h"
00022 
00023 #ifdef WIN32
00024 #define VTKTCL_EXPORT __declspec( dllexport )
00025 #else
00026 #define VTKTCL_EXPORT
00027 #endif
00028 
00029 extern VTKTCL_EXPORT void vtkTclUpdateCommand(Tcl_Interp *interp,
00030                                               char *name,
00031                                               vtkObject *obj);
00032 
00033 extern VTKTCL_EXPORT void vtkTclDeleteObjectFromHash(vtkObject *,
00034                                                      unsigned long eventId,
00035                                                      void *, void *);
00036 extern VTKTCL_EXPORT void vtkTclGenericDeleteObject(ClientData cd);
00037 
00038 extern VTKTCL_EXPORT void
00039 vtkTclGetObjectFromPointer(Tcl_Interp *interp, void *temp,
00040                            const char *targetType);
00041 
00042 extern VTKTCL_EXPORT void *
00043 vtkTclGetPointerFromObject(const char *name, const char *result_type,
00044                            Tcl_Interp *interp, int &error);
00045 
00046 extern VTKTCL_EXPORT void vtkTclVoidFunc(void *);
00047 extern VTKTCL_EXPORT void vtkTclVoidFuncArgDelete(void *);
00048 extern VTKTCL_EXPORT void vtkTclListInstances(Tcl_Interp *interp,
00049                                               ClientData arg);
00050 extern VTKTCL_EXPORT int  vtkTclInDelete(Tcl_Interp *interp);
00051 
00052 extern VTKTCL_EXPORT int vtkTclNewInstanceCommand(ClientData cd,
00053                                                   Tcl_Interp *interp,
00054                                                   int argc, char *argv[]);
00055 extern VTKTCL_EXPORT void vtkTclDeleteCommandStruct(ClientData cd);
00056 extern VTKTCL_EXPORT
00057 void vtkTclCreateNew(Tcl_Interp *interp, const char *cname,
00058                      ClientData (*NewCommand)(),
00059                      int (*CommandFunction)(ClientData cd,
00060                                             Tcl_Interp *interp,
00061                                             int argc, char *argv[]));
00062 
00063 class vtkTclCommand : public vtkCommand
00064 {
00065 public:
00066   static vtkTclCommand *New() { return new vtkTclCommand; };
00067 
00068   void SetStringCommand(const char *arg);
00069   void SetInterp(Tcl_Interp *interp) { this->Interp = interp; };
00070 
00071   void Execute(vtkObject *, unsigned long, void *);
00072 
00073   char *StringCommand;
00074   Tcl_Interp *Interp;
00075 protected:
00076   vtkTclCommand();
00077   ~vtkTclCommand();
00078 };
00079 
00080 typedef struct _vtkTclVoidFuncArg
00081 {
00082   Tcl_Interp *interp;
00083   char *command;
00084 } vtkTclVoidFuncArg;
00085 
00086 struct vtkTclCommandArgStruct
00087 {
00088   void *Pointer;
00089   Tcl_Interp *Interp;
00090   unsigned long Tag;
00091 };
00092 
00093 struct vtkTclCommandStruct
00094 {
00095   ClientData (*NewCommand)();
00096   int (*CommandFunction)(ClientData cd, Tcl_Interp *interp,
00097                          int argc, char *argv[]);
00098 };
00099 
00100 struct vtkTclInterpStruct
00101 {
00102   Tcl_HashTable InstanceLookup;
00103   Tcl_HashTable PointerLookup;
00104   Tcl_HashTable CommandLookup;
00105 
00106   int Number;
00107   int DebugOn;
00108   int InDelete;
00109   int DeleteExistingObjectOnNew;
00110 };
00111 
00112 extern VTKTCL_EXPORT
00113 void vtkTclApplicationInitExecutable(int argc, const char* const argv[]);
00114 extern VTKTCL_EXPORT
00115 void vtkTclApplicationInitTclTk(Tcl_Interp* interp,
00116                                 const char* const relative_dirs[]);
00117 
00118 #endif