chiark / gitweb /
provide errorCode for invalid reverse addrs
[chiark-tcl.git] / hbytes / parse.c
1 /*
2  */
3
4 #include "chiark_tcl_hbytes.h"
5
6 int cht_pat_hbv(Tcl_Interp *ip, Tcl_Obj *var, HBytes_Var *agg) {
7   int rc;
8   rc= cht_pat_somethingv(ip,var,&agg->sth,&cht_hbytes_type);
9   if (rc) return rc;
10   agg->hb= OBJ_HBYTES(agg->sth.obj);
11   return TCL_OK;
12 }
13 int cht_pat_hb(Tcl_Interp *ip, Tcl_Obj *obj, HBytes_Value *val) {
14   int rc;
15   rc= Tcl_ConvertToType(ip,obj,&cht_hbytes_type);  if (rc) return rc;
16   *val= *OBJ_HBYTES(obj);
17   return TCL_OK;
18 }
19
20 Tcl_Obj *cht_ret_hb(Tcl_Interp *ip, HBytes_Value val) {
21   Tcl_Obj *obj;
22   obj= Tcl_NewObj();
23   Tcl_InvalidateStringRep(obj);
24   *OBJ_HBYTES(obj)= val;
25   obj->typePtr= &cht_hbytes_type;
26   return obj;
27 }