2 * hbytes - hex-stringrep efficient byteblocks for Tcl
3 * Copyright 2006-2012 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, see <http://www.gnu.org/licenses/>.
19 #include "chiark_tcl_hbytes.h"
21 int cht_pat_hbv(Tcl_Interp *ip, Tcl_Obj *var, HBytes_Var *agg) {
23 rc= cht_pat_somethingv(ip,var,&agg->sth,&cht_hbytes_type);
25 agg->hb= OBJ_HBYTES(agg->sth.obj);
28 int cht_pat_hb(Tcl_Interp *ip, Tcl_Obj *obj, HBytes_Value *val) {
30 rc= Tcl_ConvertToType(ip,obj,&cht_hbytes_type); if (rc) return rc;
31 *val= *OBJ_HBYTES(obj);
35 Tcl_Obj *cht_ret_hb(Tcl_Interp *ip, HBytes_Value val) {
38 Tcl_InvalidateStringRep(obj);
39 *OBJ_HBYTES(obj)= val;
40 obj->typePtr= &cht_hbytes_type;