diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2023-02-11 01:51:32 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2023-02-11 01:51:32 (GMT) |
commit | c2f0e2f8da529b6bd9f8793a07e73ed1bb6eb903 (patch) | |
tree | 53ec5e70589f0a7f16f5a33a44f1e01ecf8f2c23 /generic | |
parent | e26214c28753b22c398ba4d7196a8afae999ab5a (diff) | |
download | tcl-c2f0e2f8da529b6bd9f8793a07e73ed1bb6eb903.zip tcl-c2f0e2f8da529b6bd9f8793a07e73ed1bb6eb903.tar.gz tcl-c2f0e2f8da529b6bd9f8793a07e73ed1bb6eb903.tar.bz2 |
Eliminate TCL_ENCODING_{STRICT,NOCOMPLAIN}
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tcl.h | 12 | ||||
-rw-r--r-- | generic/tclEncoding.c | 37 | ||||
-rw-r--r-- | generic/tclIO.h | 6 |
3 files changed, 10 insertions, 45 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index ec94e71..b7d31aa 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2127,14 +2127,8 @@ typedef struct Tcl_EncodingType { * 0x00. Only valid for "utf-8" and "cesu-8". * This flag is implicit for external -> internal conversions, * optional for internal -> external conversions. - * TCL_ENCODING_NOCOMPLAIN - If set, the converter - * substitutes the problematic character(s) with - * one or more "close" characters in the - * destination buffer and then continues to - * convert the source. If clear, the converter returns - * immediately upon encountering an invalid byte sequence - * or a source character that has no mapping in the - * target encoding. Only for Tcl 9.x. + * TCL_ENCODING_PROFILE_* - Mutually exclusive encoding profile ids. Note + * these are bit masks. */ #define TCL_ENCODING_START 0x01 @@ -2143,8 +2137,6 @@ typedef struct Tcl_EncodingType { #define TCL_ENCODING_NO_TERMINATE 0x08 #define TCL_ENCODING_CHAR_LIMIT 0x10 #define TCL_ENCODING_MODIFIED 0x20 -#define TCL_ENCODING_NOCOMPLAIN 0x40 -#define TCL_ENCODING_STRICT 0x44 /* Reserve top byte for profile values (disjoint) */ #define TCL_ENCODING_PROFILE_TCL8 0x01000000 #define TCL_ENCODING_PROFILE_STRICT 0x02000000 diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 153f8d3..85c2b6a 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -574,7 +574,7 @@ TclInitEncodingSubsystem(void) type.nullSize = 1; type.clientData = INT2PTR(TCL_ENCODING_UTF); Tcl_CreateEncoding(&type); - type.clientData = INT2PTR(TCL_ENCODING_NOCOMPLAIN); + type.clientData = INT2PTR(0); type.encodingName = "cesu-8"; Tcl_CreateEncoding(&type); @@ -583,13 +583,13 @@ TclInitEncodingSubsystem(void) type.freeProc = NULL; type.nullSize = 2; type.encodingName = "ucs-2le"; - type.clientData = INT2PTR(TCL_ENCODING_LE|TCL_ENCODING_NOCOMPLAIN); + type.clientData = INT2PTR(TCL_ENCODING_LE); Tcl_CreateEncoding(&type); type.encodingName = "ucs-2be"; - type.clientData = INT2PTR(TCL_ENCODING_NOCOMPLAIN); + type.clientData = INT2PTR(0); Tcl_CreateEncoding(&type); type.encodingName = "ucs-2"; - type.clientData = INT2PTR(isLe.c|TCL_ENCODING_NOCOMPLAIN); + type.clientData = INT2PTR(isLe.c); Tcl_CreateEncoding(&type); type.toUtfProc = Utf32ToUtfProc; @@ -2324,16 +2324,11 @@ BinaryProc( *------------------------------------------------------------------------- */ -#ifdef OBSOLETE -#if TCL_MAJOR_VERSION > 8 || defined(TCL_NO_DEPRECATED) -# define STOPONERROR (!(flags & TCL_ENCODING_NOCOMPLAIN) || (flags & TCL_ENCODING_STOPONERROR)) -#else -# define STOPONERROR (flags & TCL_ENCODING_STOPONERROR) -#endif -#endif - +#define STRICT_PROFILE(flags_) \ + ((TCL_ENCODING_PROFILE_GET(flags_) == TCL_ENCODING_PROFILE_STRICT) \ + || (TCL_ENCODING_PROFILE_GET(flags_) == 0 \ + && TCL_ENCODING_PROFILE_DEFAULT == TCL_ENCODING_PROFILE_STRICT)) -#define STRICT_PROFILE(flags_) (TCL_ENCODING_PROFILE_GET(flags_) == TCL_ENCODING_PROFILE_STRICT) #define STOPONERROR STRICT_PROFILE(flags) static int @@ -4196,10 +4191,6 @@ TclEncodingProfileIdToName( * * Maps the flags supported in the encoding C API's to internal flags. * - * TCL_ENCODING_STRICT and TCL_ENCODING_NOCOMPLAIN are masked off - * because they are for internal use only and externally specified - * through TCL_ENCODING_PROFILE_* bits. - * * For backward compatibility reasons, TCL_ENCODING_STOPONERROR is * is mapped to the TCL_ENCODING_PROFILE_STRICT overwriting any profile * specified. @@ -4217,7 +4208,6 @@ TclEncodingProfileIdToName( */ int TclEncodingExternalFlagsToInternal(int flags) { - flags &= ~(TCL_ENCODING_STRICT | TCL_ENCODING_NOCOMPLAIN); if (flags & TCL_ENCODING_STOPONERROR) { TCL_ENCODING_PROFILE_SET(flags, TCL_ENCODING_PROFILE_STRICT); } @@ -4225,22 +4215,11 @@ int TclEncodingExternalFlagsToInternal(int flags) int profile = TCL_ENCODING_PROFILE_GET(flags); switch (profile) { case TCL_ENCODING_PROFILE_TCL8: - flags |= TCL_ENCODING_NOCOMPLAIN; - break; case TCL_ENCODING_PROFILE_STRICT: - flags |= TCL_ENCODING_STRICT; break; case 0: /* Unspecified by caller */ default: - /* TODO - clean this up once default mechanisms settled */ TCL_ENCODING_PROFILE_SET(flags, TCL_ENCODING_PROFILE_DEFAULT); -#if TCL_ENCODING_PROFILE_DEFAULT == TCL_ENCODING_PROFILE_TCL8 - flags |= TCL_ENCODING_NOCOMPLAIN; -#elif TCL_ENCODING_PROFILE_DEFAULT == TCL_ENCODING_PROFILE_STRICT - flags |= TCL_ENCODING_STRICT; -#else -#error TCL_ENCODING_PROFILE_DEFAULT must be TCL8 or STRICT -#endif break; } } diff --git a/generic/tclIO.h b/generic/tclIO.h index 3f2feee..dded07f 100644 --- a/generic/tclIO.h +++ b/generic/tclIO.h @@ -275,12 +275,6 @@ typedef struct ChannelState { * encountered an encoding error */ #define CHANNEL_RAW_MODE (1<<16) /* When set, notes that the Raw API is * being used. */ -#ifdef APN -#define CHANNEL_ENCODING_NOCOMPLAIN (1<<17) /* set if option - * -nocomplainencoding is set to 1 */ -#define CHANNEL_ENCODING_STRICT (1<<18) /* set if option - * -strictencoding is set to 1 */ -#endif #define CHANNEL_INCLOSE (1<<19) /* Channel is currently being closed. * Its structures are still live and * usable, but it may not be closed |