- 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;
+}