From 379bdae5c3feed0328500dd805b3e51c06d0383f Mon Sep 17 00:00:00 2001 From: hobbs Date: Wed, 16 Jul 2003 22:03:51 +0000 Subject: * generic/tcl.h: add recognition of -DTCL_UTF_MAX=6 on the * generic/regcustom.h: make line to support UCS-4 mode. No config arg at this time, as it is not the recommended build mode. --- ChangeLog | 10 ++++++++++ generic/regcustom.h | 6 ++++++ generic/tcl.h | 23 ++++++++++++++++++++--- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 72cfca7..c7d4f8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-07-16 Jeff Hobbs + + * generic/tcl.h: add recognition of -DTCL_UTF_MAX=6 on the + * generic/regcustom.h: make line to support UCS-4 mode. No config + arg at this time, as it is not the recommended build mode. + + * generic/tclPreserve.c: In Result and Preserve'd routines, do not + * generic/tclUtil.c: assume that ckfree == free, as that is not + * generic/tclResult.c: always true. [Bug 756791] (fuller) + 2003-07-16 Donal K. Fellows * doc/CrtSlave.3 (Tcl_MakeSafe): Updated documentation to strongly diff --git a/generic/regcustom.h b/generic/regcustom.h index 9f505de..e258acd 100644 --- a/generic/regcustom.h +++ b/generic/regcustom.h @@ -91,9 +91,15 @@ typedef int celt; /* type to hold chr, MCCE number, or NOCELT */ #define NOCELT (-1) /* celt value which is not valid chr or MCCE */ #define CHR(c) (UCHAR(c)) /* turn char literal into chr literal */ #define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */ +#if TCL_UTF_MAX > 3 +#define CHRBITS 32 /* bits in a chr; must not use sizeof */ +#define CHR_MIN 0x00000000 /* smallest and largest chr; the value */ +#define CHR_MAX 0xffffffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */ +#else #define CHRBITS 16 /* bits in a chr; must not use sizeof */ #define CHR_MIN 0x0000 /* smallest and largest chr; the value */ #define CHR_MAX 0xffff /* CHR_MAX-CHR_MIN+1 should fit in uchr */ +#endif /* functions operating on chr */ #define iscalnum(x) Tcl_UniCharIsAlnum(x) diff --git a/generic/tcl.h b/generic/tcl.h index 6c87307..8a62eae 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.158 2003/06/09 22:48:32 andreas_kupries Exp $ + * RCS: @(#) $Id: tcl.h,v 1.159 2003/07/16 22:03:52 hobbs Exp $ */ #ifndef _TCL @@ -2186,15 +2186,32 @@ typedef struct Tcl_Parse { /* * The maximum number of bytes that are necessary to represent a single - * Unicode character in UTF-8. - */ + * Unicode character in UTF-8. The valid values should be 3 or 6 (or + * perhaps 1 if we want to support a non-unicode enabled core). + * If 3, then Tcl_UniChar must be 2-bytes in size (UCS-2). (default) + * If 6, then Tcl_UniChar must be 4-bytes in size (UCS-4). + * At this time UCS-2 mode is the default and recommended mode. + * UCS-4 is experimental and not recommended. It works for the core, + * but most extensions expect UCS-2. + */ +#ifndef TCL_UTF_MAX #define TCL_UTF_MAX 3 +#endif /* * This represents a Unicode character. Any changes to this should * also be reflected in regcustom.h. */ +#if TCL_UTF_MAX > 3 + /* + * unsigned int isn't 100% accurate as it should be a strict 4-byte + * value (perhaps wchar_t). 64-bit systems may have troubles. The + * size of this value must be reflected correctly in regcustom.h. + */ +typedef unsigned int Tcl_UniChar; +#else typedef unsigned short Tcl_UniChar; +#endif /* TIP #59: The following structure is used in calls * 'Tcl_RegisterConfig' to provide the system with the embedded -- cgit v0.12