chiark / gitweb /
adns wip
[chiark-tcl.git] / base / tcmdiflib.c
1 /*
2  */
3
4 #include "tcmdiflib.h"
5
6 int pat_enum(Tcl_Interp *ip, Tcl_Obj *obj, const void **val,
7              const void *opts, size_t sz, const char *what) {
8   *val= enum_lookup_cached_func(ip,obj,opts,sz,what);
9   if (!*val) return TCL_ERROR;
10   return TCL_OK;
11 }
12   
13 int pat_obj(Tcl_Interp *ip, Tcl_Obj *obj, Tcl_Obj **val) {
14   *val= obj;
15   return TCL_OK;
16 }
17
18 Tcl_Obj *ret_int(Tcl_Interp *ip, int val) {
19   return Tcl_NewIntObj(val);
20 }
21
22 Tcl_Obj *ret_obj(Tcl_Interp *ip, Tcl_Obj *val) {
23   return val;
24 }
25
26 void setstringresult(Tcl_Interp *ip, const char *m) {
27   Tcl_ResetResult(ip);
28   Tcl_AppendResult(ip, m, (char*)0);
29 }