X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-tcl.git;a=blobdiff_plain;f=hbytes%2Fparse.c;h=a3635142bb3dfe186da16b1051a2a513693b4b0d;hp=125dd61eb9e182a2fbfd36f46ac824f38a9f006e;hb=82f88c53ddb84e42c770c23feb9bb0ee18341188;hpb=310a482133795d0bee9621003c0a0b3813a47037 diff --git a/hbytes/parse.c b/hbytes/parse.c index 125dd61..a363514 100644 --- a/hbytes/parse.c +++ b/hbytes/parse.c @@ -1,16 +1,20 @@ - sc= enum_lookup_cached(ip,objv[1],subcommands,"hbytes subcommand"); +/* + */ +#include "chiark_tcl_hbytes.h" -static Tcl_Obj *hb_getvar(Tcl_Interp *ip, Tcl_Obj *varname) { - int ec; - Tcl_Obj *value; - - value= Tcl_ObjGetVar2(ip,varname,0,TCL_LEAVE_ERR_MSG); - if (!value) return 0; - - ec= Tcl_ConvertToType(ip,value,&hbytes_type); - if (ec) return 0; - - return value; +int cht_pat_hb(Tcl_Interp *ip, Tcl_Obj *obj, HBytes_Value *val) { + int rc; + rc= Tcl_ConvertToType(ip,obj,&cht_hbytes_type); if (rc) return rc; + *val= *OBJ_HBYTES(obj); + return TCL_OK; } +Tcl_Obj *cht_ret_hb(Tcl_Interp *ip, HBytes_Value val) { + Tcl_Obj *obj; + obj= Tcl_NewObj(); + Tcl_InvalidateStringRep(obj); + *OBJ_HBYTES(obj)= val; + obj->typePtr= &cht_hbytes_type; + return obj; +}