chiark / gitweb /
a3635142bb3dfe186da16b1051a2a513693b4b0d
[chiark-tcl.git] / hbytes / parse.c
1 /*
2  */
3
4 #include "chiark_tcl_hbytes.h"
5
6 int cht_pat_hb(Tcl_Interp *ip, Tcl_Obj *obj, HBytes_Value *val) {
7   int rc;
8   rc= Tcl_ConvertToType(ip,obj,&cht_hbytes_type);  if (rc) return rc;
9   *val= *OBJ_HBYTES(obj);
10   return TCL_OK;
11 }
12
13 Tcl_Obj *cht_ret_hb(Tcl_Interp *ip, HBytes_Value val) {
14   Tcl_Obj *obj;
15   obj= Tcl_NewObj();
16   Tcl_InvalidateStringRep(obj);
17   *OBJ_HBYTES(obj)= val;
18   obj->typePtr= &cht_hbytes_type;
19   return obj;
20 }