2 * hbytes - hex-stringrep efficient byteblocks for Tcl
3 * Copyright 2006 Ian Jackson
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 #include "chiark_tcl_hbytes.h"
23 int cht_pat_hbv(Tcl_Interp *ip, Tcl_Obj *var, HBytes_Var *agg) {
25 rc= cht_pat_somethingv(ip,var,&agg->sth,&cht_hbytes_type);
27 agg->hb= OBJ_HBYTES(agg->sth.obj);
30 int cht_pat_hb(Tcl_Interp *ip, Tcl_Obj *obj, HBytes_Value *val) {
32 rc= Tcl_ConvertToType(ip,obj,&cht_hbytes_type); if (rc) return rc;
33 *val= *OBJ_HBYTES(obj);
37 Tcl_Obj *cht_ret_hb(Tcl_Interp *ip, HBytes_Value val) {
40 Tcl_InvalidateStringRep(obj);
41 *OBJ_HBYTES(obj)= val;
42 obj->typePtr= &cht_hbytes_type;