Posted to tcl by dbohdan at Sun Sep 01 21:01:45 GMT 2019view raw

  1. # More diabolical than the title suggests.
  2. package require critcl
  3.  
  4. critcl::ccommand purify {cdata interp objc objv} {
  5. if (objc != 2) {
  6. Tcl_WrongNumArgs(interp, 1, objv, "value");
  7. return TCL_ERROR;
  8. }
  9.  
  10. int len;
  11. char* s = Tcl_GetStringFromObj(objv[1], &len);
  12. Tcl_Obj* obj = Tcl_NewStringObj(s, len);
  13. Tcl_SetObjResult(interp, obj);
  14.  
  15. return TCL_OK;
  16. }