chiark / gitweb /
document tcmdifgen (and split from app, in theory)
[chiark-tcl.git] / base / tcmdiflib.c
diff --git a/base/tcmdiflib.c b/base/tcmdiflib.c
new file mode 100644 (file)
index 0000000..8bddc02
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ */
+
+#include "tcmdiflib.h"
+
+int pat_enum(Tcl_Interp *ip, Tcl_Obj *obj, const void **val,
+            const void *opts, size_t sz, const char *what) {
+  *val= enum_lookup_cached_func(ip,obj,opts,sz,what);
+  if (!*val) return TCL_ERROR;
+  return TCL_OK;
+}
+  
+int pat_obj(Tcl_Interp *ip, Tcl_Obj *obj, Tcl_Obj **val) {
+  *val= obj;
+  return TCL_OK;
+}
+
+Tcl_Obj *ret_int(Tcl_Interp *ip, int val) {
+  return Tcl_NewIntObj(val);
+}
+
+Tcl_Obj *ret_obj(Tcl_Interp *ip, Tcl_Obj *val) {
+  return val;
+}
+
+void setstringresult(Tcl_Interp *ip, const char *m) {
+  Tcl_ResetResult(ip);
+  Tcl_AppendResult(ip, m, (char*)0);
+}