2 * base code for various Tcl extensions
3 * Copyright 2006-2012 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, see <http://www.gnu.org/licenses/>.
19 #include "chiark-tcl-base.h"
21 int cht_pat_enum(Tcl_Interp *ip, Tcl_Obj *obj, const void **val,
22 const void *opts, size_t sz, const char *what) {
23 *val= cht_enum_lookup_cached_func(ip,obj,opts,sz,what);
24 if (!*val) return TCL_ERROR;
28 int cht_pat_obj(Tcl_Interp *ip, Tcl_Obj *obj, Tcl_Obj **val) {
33 Tcl_Obj *cht_ret_int(Tcl_Interp *ip, int val) {
34 return Tcl_NewIntObj(val);
37 Tcl_Obj *cht_ret_obj(Tcl_Interp *ip, Tcl_Obj *val) {
41 void cht_setstringresult(Tcl_Interp *ip, const char *m) {
43 Tcl_AppendResult(ip, m, (char*)0);