Posted to tcl by dbohdan at Sun Sep 01 21:01:45 GMT 2019view raw
- # More diabolical than the title suggests.
- package require critcl
- critcl::ccommand purify {cdata interp objc objv} {
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "value");
- return TCL_ERROR;
- }
- int len;
- char* s = Tcl_GetStringFromObj(objv[1], &len);
- Tcl_Obj* obj = Tcl_NewStringObj(s, len);
- Tcl_SetObjResult(interp, obj);
- return TCL_OK;
- }