X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=base%2Fenum.c;h=8041cd378a5b05f1c486f2f4049700299f91c631;hb=b78c59b29c46210ccbfc0fe4815b4e49fba8817b;hp=a4e9de7ff9ad0f0d6d686f97f1c049023db2ccec;hpb=6347c760d4dae4f5a7239ca660b1478ccc48eabf;p=chiark-tcl.git diff --git a/base/enum.c b/base/enum.c index a4e9de7..8041cd3 100644 --- a/base/enum.c +++ b/base/enum.c @@ -28,6 +28,35 @@ Tcl_ObjType enum1_nearlytype = { 0, enum_nt_dup, enum_nt_ustr, enum_nt_sfa }; +static void report_bad(Tcl_Interp *ip, const char *what, const char *supplied, + const void *first, size_t each, + int (*isvalid)(const void *entry), + void (*appres)(Tcl_Interp *ip, const void *entry)) { + int count, i; + const Byte *entry; + + for (entry=first; isvalid(entry); entry+=each); + count= (entry - (const Byte*)first) / each; + + Tcl_ResetResult(ip); + Tcl_AppendResult(ip, "bad ",what," \"",supplied,"\": must be",(char*)0); + + for (i=0, entry=first; i