PageRenderTime 50ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Lib/tcl/tclinit.swg

#
Unknown | 141 lines | 117 code | 24 blank | 0 comment | 0 complexity | cbf3d4d3cba899a253a4505f054215cb MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /* ------------------------------------------------------------
  2. * The start of the Tcl initialization function
  3. * ------------------------------------------------------------ */
  4. %insert(init) "swiginit.swg"
  5. /* This initialization code exports the module initialization function */
  6. %header %{
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. #ifdef MAC_TCL
  11. #pragma export on
  12. #endif
  13. SWIGEXPORT int SWIG_init(Tcl_Interp *);
  14. #ifdef MAC_TCL
  15. #pragma export off
  16. #endif
  17. #ifdef __cplusplus
  18. }
  19. #endif
  20. /* Compatibility version for TCL stubs */
  21. #ifndef SWIG_TCL_STUBS_VERSION
  22. #define SWIG_TCL_STUBS_VERSION "8.1"
  23. #endif
  24. %}
  25. %init %{
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /* -----------------------------------------------------------------------------
  30. * constants/methods manipulation
  31. * ----------------------------------------------------------------------------- */
  32. /* Install Constants */
  33. SWIGINTERN void
  34. SWIG_Tcl_InstallConstants(Tcl_Interp *interp, swig_const_info constants[]) {
  35. size_t i;
  36. Tcl_Obj *obj;
  37. if (!swigconstTableinit) {
  38. Tcl_InitHashTable(&swigconstTable, TCL_STRING_KEYS);
  39. swigconstTableinit = 1;
  40. }
  41. for (i = 0; constants[i].type; i++) {
  42. switch(constants[i].type) {
  43. case SWIG_TCL_POINTER:
  44. obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
  45. break;
  46. case SWIG_TCL_BINARY:
  47. obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
  48. break;
  49. default:
  50. obj = 0;
  51. break;
  52. }
  53. if (obj) {
  54. SWIG_Tcl_SetConstantObj(interp, constants[i].name, obj);
  55. }
  56. }
  57. }
  58. /* Create fast method lookup tables */
  59. SWIGINTERN void
  60. SWIG_Tcl_InstallMethodLookupTables(void) {
  61. size_t i;
  62. for (i = 0; i < swig_module.size; ++i) {
  63. swig_type_info *type = swig_module.type_initial[i];
  64. if (type->clientdata) {
  65. swig_class* klass = (swig_class*) type->clientdata;
  66. swig_method* meth;
  67. Tcl_InitHashTable(&(klass->hashtable), TCL_STRING_KEYS);
  68. for (meth = klass->methods; meth && meth->name; ++meth) {
  69. int newEntry;
  70. Tcl_HashEntry* hashentry = Tcl_CreateHashEntry(&(klass->hashtable), meth->name, &newEntry);
  71. Tcl_SetHashValue(hashentry, (ClientData)meth->method);
  72. }
  73. }
  74. }
  75. }
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. /* -----------------------------------------------------------------------------*
  80. * Partial Init method
  81. * -----------------------------------------------------------------------------*/
  82. SWIGEXPORT int SWIG_init(Tcl_Interp *interp) {
  83. size_t i;
  84. if (interp == 0) return TCL_ERROR;
  85. #ifdef USE_TCL_STUBS
  86. /* (char*) cast is required to avoid compiler warning/error for Tcl < 8.4. */
  87. if (Tcl_InitStubs(interp, (char*)SWIG_TCL_STUBS_VERSION, 0) == NULL) {
  88. return TCL_ERROR;
  89. }
  90. #endif
  91. #ifdef USE_TK_STUBS
  92. /* (char*) cast is required to avoid compiler warning/error. */
  93. if (Tk_InitStubs(interp, (char*)SWIG_TCL_STUBS_VERSION, 0) == NULL) {
  94. return TCL_ERROR;
  95. }
  96. #endif
  97. Tcl_PkgProvide(interp, (char*)SWIG_name, (char*)SWIG_version);
  98. #ifdef SWIG_namespace
  99. Tcl_Eval(interp, "namespace eval " SWIG_namespace " { }");
  100. #endif
  101. SWIG_InitializeModule((void *) interp);
  102. SWIG_PropagateClientData();
  103. for (i = 0; swig_commands[i].name; i++) {
  104. Tcl_CreateObjCommand(interp, (char *) swig_commands[i].name, (swig_wrapper_func) swig_commands[i].wrapper,
  105. swig_commands[i].clientdata, NULL);
  106. }
  107. for (i = 0; swig_variables[i].name; i++) {
  108. Tcl_SetVar(interp, (char *) swig_variables[i].name, (char *) "", TCL_GLOBAL_ONLY);
  109. Tcl_TraceVar(interp, (char *) swig_variables[i].name, TCL_TRACE_READS | TCL_GLOBAL_ONLY,
  110. (Tcl_VarTraceProc *) swig_variables[i].get, (ClientData) swig_variables[i].addr);
  111. Tcl_TraceVar(interp, (char *) swig_variables[i].name, TCL_TRACE_WRITES | TCL_GLOBAL_ONLY,
  112. (Tcl_VarTraceProc *) swig_variables[i].set, (ClientData) swig_variables[i].addr);
  113. }
  114. SWIG_Tcl_InstallConstants(interp, swig_constants);
  115. SWIG_Tcl_InstallMethodLookupTables();
  116. %}
  117. /* Note: the initialization function is closed after all code is generated */