chiark / gitweb /
initial import and build-faff, wip
[chiark-tcl.git] / base / tcmdiflib.c
1 /*
2  */
3
4 #include "chiark-tcl.h"
5 #include "tables.h"
6
7 int cht_pat_enum(Tcl_Interp *ip, Tcl_Obj *obj, const void **val,
8              const void *opts, size_t sz, const char *what) {
9   *val= cht_enum_lookup_cached_func(ip,obj,opts,sz,what);
10   if (!*val) return TCL_ERROR;
11   return TCL_OK;
12 }
13   
14 int cht_pat_obj(Tcl_Interp *ip, Tcl_Obj *obj, Tcl_Obj **val) {
15   *val= obj;
16   return TCL_OK;
17 }
18
19 Tcl_Obj *cht_ret_int(Tcl_Interp *ip, int val) {
20   return Tcl_NewIntObj(val);
21 }
22
23 Tcl_Obj *cht_ret_obj(Tcl_Interp *ip, Tcl_Obj *val) {
24   return val;
25 }
26
27 void cht_setstringresult(Tcl_Interp *ip, const char *m) {
28   Tcl_ResetResult(ip);
29   Tcl_AppendResult(ip, m, (char*)0);
30 }