SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { int i; PyObject *obj; for (i = 0; constants[i].type; i++) { switch(constants[i].type) { case SWIG_PY_INT: obj = PyInt_FromLong(constants[i].lvalue); break; case SWIG_PY_FLOAT: obj = PyFloat_FromDouble(constants[i].dvalue); break; case SWIG_PY_STRING: obj = PyString_FromString((char *) constants[i].pvalue); break; case SWIG_PY_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_PY_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); break; default: obj = 0; break; } if (obj) { PyDict_SetItemString(d,constants[i].name,obj); Py_DECREF(obj); } } }
SWIG_Tcl_InstallConstants(Tcl_Interp *interp, swig_const_info constants[]) { int i; Tcl_Obj *obj; Tcl_HashEntry *entryPtr; int newobj; if (!swigconstTableinit) { Tcl_InitHashTable(&swigconstTable, TCL_STRING_KEYS); swigconstTableinit = 1; } for (i = 0; constants[i].type; i++) { switch(constants[i].type) { case SWIG_TCL_INT: obj = Tcl_NewIntObj(constants[i].lvalue); break; case SWIG_TCL_FLOAT: obj = Tcl_NewDoubleObj(constants[i].dvalue); break; case SWIG_TCL_STRING: obj = Tcl_NewStringObj((char *) constants[i].pvalue,-1); break; case SWIG_TCL_POINTER: obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); break; case SWIG_TCL_BINARY: obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype),0); break; default: obj = 0; break; } if (obj) { Tcl_ObjSetVar2(interp,Tcl_NewStringObj(constants[i].name,-1), NULL, obj, TCL_GLOBAL_ONLY); entryPtr = Tcl_CreateHashEntry(&swigconstTable, constants[i].name, &newobj); Tcl_SetHashValue(entryPtr, (ClientData) obj); } } }