2 * base code for various Tcl extensions
3 * Copyright 2006 Ian Jackson
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 #include "chiark-tcl-base.h"
23 int cht_pat_enum(Tcl_Interp *ip, Tcl_Obj *obj, const void **val,
24 const void *opts, size_t sz, const char *what) {
25 *val= cht_enum_lookup_cached_func(ip,obj,opts,sz,what);
26 if (!*val) return TCL_ERROR;
30 int cht_pat_obj(Tcl_Interp *ip, Tcl_Obj *obj, Tcl_Obj **val) {
35 Tcl_Obj *cht_ret_int(Tcl_Interp *ip, int val) {
36 return Tcl_NewIntObj(val);
39 Tcl_Obj *cht_ret_obj(Tcl_Interp *ip, Tcl_Obj *val) {
43 void cht_setstringresult(Tcl_Interp *ip, const char *m) {
45 Tcl_AppendResult(ip, m, (char*)0);