chiark / gitweb /
working on compiling out of troglodyte; before relegage maskmap
[chiark-tcl.git] / hbytes / parse.c
index 125dd61eb9e182a2fbfd36f46ac824f38a9f006e..a3635142bb3dfe186da16b1051a2a513693b4b0d 100644 (file)
@@ -1,16 +1,20 @@
-  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;
+}