chiark / gitweb /
initial import and build-faff, wip
[chiark-tcl.git] / hbytes / parse.c
index 1d9123876097e82940bcb2e014a9772290322254..389f580a7f484066ea3b9317c1aaa83a850deafb 100644 (file)
@@ -1,5 +1,6 @@
 /*
  */
+/* WARNING - FILE COPIED IN REPO TO CHIARK-TCL - THIS VERSION IS OBSOLETE */
 
 #include "tables.h"
 
@@ -23,6 +24,23 @@ int pat_string(Tcl_Interp *ip, Tcl_Obj *obj, const char **val) {
   return TCL_OK;
 }
 
+int pat_constv(Tcl_Interp *ip, Tcl_Obj *var,
+              Tcl_Obj **val_r, Tcl_ObjType *type) {
+  int rc;
+  Tcl_Obj *val;
+  
+  val= Tcl_ObjGetVar2(ip,var,0,TCL_LEAVE_ERR_MSG);
+  if (!val) return TCL_ERROR;
+
+  if (type) {
+    rc= Tcl_ConvertToType(ip,val,type);
+    if (rc) return rc;
+  }
+
+  *val_r= val;
+  return TCL_OK;
+}
+
 void init_somethingv(Something_Var *sth) {
   sth->obj=0; sth->var=0; sth->copied=0;
 }