MCPcopy Create free account
hub / github.com/Colvars/colvars / tcl_python_convert

Function tcl_python_convert

namd/src/ScriptTcl.C:191–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189static int atoBool(const char *s);
190
191static PyObject* tcl_python_convert(Tcl_Obj *obj) {
192 long rlong;
193 if ( TCL_OK == Tcl_GetLongFromObj(0, obj, &rlong) )
194 return Py_BuildValue("l", rlong);
195 double rdouble;
196 if ( TCL_OK == Tcl_GetDoubleFromObj(0, obj, &rdouble) )
197 return Py_BuildValue("d", rdouble);
198 const char *rstring = Tcl_GetString(obj);
199 if ( rstring[0] == '\0' )
200 return Py_None;
201 int rbool = atoBool(rstring);
202 if ( rbool >= 0 )
203 return PyBool_FromLong(rbool);
204 return Py_BuildValue("s", rstring);
205}
206
207static Tcl_Interp *static_interp;
208

Callers 2

python_tcl_callFunction · 0.85
python_tcl_evalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected