PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/Lib/tcl/tclapi.swg

#
Unknown | 108 lines | 90 code | 18 blank | 0 comment | 0 complexity | 07833963354644bc11c24bf9951695e0 MD5 | raw file
  1/* -----------------------------------------------------------------------------
  2 * SWIG API. Portion that goes into the runtime
  3 * ----------------------------------------------------------------------------- */
  4#ifdef __cplusplus
  5extern "C" {
  6#endif
  7
  8/* -----------------------------------------------------------------------------
  9 * Constant declarations
 10 * ----------------------------------------------------------------------------- */
 11
 12/* Constant Types */
 13#define SWIG_TCL_POINTER 4
 14#define SWIG_TCL_BINARY  5
 15
 16/* Constant information structure */
 17typedef struct swig_const_info {
 18    int type;
 19    char *name;
 20    long lvalue;
 21    double dvalue;
 22    void   *pvalue;
 23    swig_type_info **ptype;
 24} swig_const_info;
 25
 26typedef int   (*swig_wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []);
 27typedef int   (*swig_wrapper_func)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []);
 28typedef char *(*swig_variable_func)(ClientData, Tcl_Interp *, char *, char *, int);
 29typedef void  (*swig_delete_func)(ClientData);
 30
 31typedef struct swig_method {
 32  const char     *name;
 33  swig_wrapper   method;
 34} swig_method;
 35
 36typedef struct swig_attribute {
 37  const char     *name;
 38  swig_wrapper   getmethod;
 39  swig_wrapper   setmethod;
 40} swig_attribute;
 41
 42typedef struct swig_class {
 43  const char         *name;
 44  swig_type_info   **type;
 45  swig_wrapper       constructor;
 46  void              (*destructor)(void *);
 47  swig_method        *methods;
 48  swig_attribute     *attributes;
 49  struct swig_class **bases;
 50  const char              **base_names;
 51  swig_module_info   *module;
 52  Tcl_HashTable       hashtable;
 53} swig_class;
 54
 55typedef struct swig_instance {
 56  Tcl_Obj       *thisptr;
 57  void          *thisvalue;
 58  swig_class   *classptr;
 59  int            destroy;
 60  Tcl_Command    cmdtok;
 61} swig_instance;
 62
 63/* Structure for command table */
 64typedef struct {
 65  const char *name;
 66  int       (*wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []);
 67  ClientData  clientdata;
 68} swig_command_info;
 69
 70/* Structure for variable linking table */
 71typedef struct {
 72  const char *name;
 73  void *addr;
 74  char * (*get)(ClientData, Tcl_Interp *, char *, char *, int);
 75  char * (*set)(ClientData, Tcl_Interp *, char *, char *, int);
 76} swig_var_info;
 77
 78
 79/* -----------------------------------------------------------------------------*
 80 *  Install a constant object 
 81 * -----------------------------------------------------------------------------*/
 82
 83static Tcl_HashTable   swigconstTable;
 84static int             swigconstTableinit = 0;
 85
 86SWIGINTERN void
 87SWIG_Tcl_SetConstantObj(Tcl_Interp *interp, const char* name, Tcl_Obj *obj) {
 88  int newobj;
 89  Tcl_ObjSetVar2(interp,Tcl_NewStringObj(name,-1), NULL, obj, TCL_GLOBAL_ONLY);
 90  Tcl_SetHashValue(Tcl_CreateHashEntry(&swigconstTable, name, &newobj), (ClientData) obj);
 91}
 92
 93SWIGINTERN Tcl_Obj *
 94SWIG_Tcl_GetConstantObj(const char *key) {
 95  Tcl_HashEntry *entryPtr;
 96  if (!swigconstTableinit) return 0;
 97  entryPtr = Tcl_FindHashEntry(&swigconstTable, key);
 98  if (entryPtr) {
 99    return (Tcl_Obj *) Tcl_GetHashValue(entryPtr);
100  }
101  return 0;
102}
103
104#ifdef __cplusplus
105}
106#endif
107
108