summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-12-21 10:38:12 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-12-21 10:38:12 (GMT)
commit95aeb2a3d639d7a561200db68d85d8142a41c9c7 (patch)
treec916a352f95d0017f406b89c83f55e66f5c446fb
parentb0a98f480d3a16432d023ddb8cb4ba8e22edd973 (diff)
parente39b986e81e3813d59d6eb18cf095c1f8ceac086 (diff)
downloadtcl-95aeb2a3d639d7a561200db68d85d8142a41c9c7.zip
tcl-95aeb2a3d639d7a561200db68d85d8142a41c9c7.tar.gz
tcl-95aeb2a3d639d7a561200db68d85d8142a41c9c7.tar.bz2
Merge trunk.
Remove utf-32 encoding, will not be part of the "zipfs" TIP.
-rw-r--r--generic/regcustom.h8
-rw-r--r--generic/regex.h60
-rw-r--r--generic/tclEncoding.c242
-rw-r--r--unix/Makefile.in2
-rw-r--r--win/tclWinChan.c2
5 files changed, 21 insertions, 293 deletions
diff --git a/generic/regcustom.h b/generic/regcustom.h
index 1c970ea..681b97d 100644
--- a/generic/regcustom.h
+++ b/generic/regcustom.h
@@ -60,12 +60,6 @@
#ifdef __REG_REGOFF_T
#undef __REG_REGOFF_T
#endif
-#ifdef __REG_VOID_T
-#undef __REG_VOID_T
-#endif
-#ifdef __REG_CONST
-#undef __REG_CONST
-#endif
#ifdef __REG_NOFRONT
#undef __REG_NOFRONT
#endif
@@ -75,8 +69,6 @@
/* Interface types */
#define __REG_WIDE_T Tcl_UniChar
#define __REG_REGOFF_T long /* Not really right, but good enough... */
-#define __REG_VOID_T void
-#define __REG_CONST const
/* Names and declarations */
#define __REG_WIDE_COMPILE TclReComp
#define __REG_WIDE_EXEC TclReExec
diff --git a/generic/regex.h b/generic/regex.h
index 53450e5..8845f72 100644
--- a/generic/regex.h
+++ b/generic/regex.h
@@ -92,12 +92,6 @@ extern "C" {
#ifdef __REG_REGOFF_T
#undef __REG_REGOFF_T
#endif
-#ifdef __REG_VOID_T
-#undef __REG_VOID_T
-#endif
-#ifdef __REG_CONST
-#undef __REG_CONST
-#endif
#ifdef __REG_NOFRONT
#undef __REG_NOFRONT
#endif
@@ -107,8 +101,6 @@ extern "C" {
/* interface types */
#define __REG_WIDE_T Tcl_UniChar
#define __REG_REGOFF_T long /* not really right, but good enough... */
-#define __REG_VOID_T void
-#define __REG_CONST const
/* names and declarations */
#define __REG_WIDE_COMPILE TclReComp
#define __REG_WIDE_EXEC TclReExec
@@ -134,26 +126,6 @@ typedef long regoff_t;
#endif
/*
- * For benefit of old compilers, we offer <sys/types.h> the option of
- * overriding the `void' type used to declare nonexistent return types.
- */
-#ifdef __REG_VOID_T
-typedef __REG_VOID_T re_void;
-#else
-typedef void re_void;
-#endif
-
-/*
- * Also for benefit of old compilers, <sys/types.h> can supply a macro which
- * expands to a substitute for `const'.
- */
-#ifndef __REG_CONST
-#define __REG_CONST const
-#endif
-
-
-
-/*
* other interface types
*/
@@ -197,13 +169,13 @@ typedef struct {
/*
* compilation
^ #ifndef __REG_NOCHAR
- ^ int re_comp(regex_t *, __REG_CONST char *, size_t, int);
+ ^ int re_comp(regex_t *, const char *, size_t, int);
^ #endif
^ #ifndef __REG_NOFRONT
- ^ int regcomp(regex_t *, __REG_CONST char *, int);
+ ^ int regcomp(regex_t *, const char *, int);
^ #endif
^ #ifdef __REG_WIDE_T
- ^ int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int);
+ ^ int __REG_WIDE_COMPILE(regex_t *, const __REG_WIDE_T *, size_t, int);
^ #endif
*/
#define REG_BASIC 000000 /* BREs (convenience) */
@@ -228,14 +200,14 @@ typedef struct {
/*
* execution
^ #ifndef __REG_NOCHAR
- ^ int re_exec(regex_t *, __REG_CONST char *, size_t,
+ ^ int re_exec(regex_t *, const char *, size_t,
^ rm_detail_t *, size_t, regmatch_t [], int);
^ #endif
^ #ifndef __REG_NOFRONT
- ^ int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int);
+ ^ int regexec(regex_t *, const char *, size_t, regmatch_t [], int);
^ #endif
^ #ifdef __REG_WIDE_T
- ^ int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t,
+ ^ int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t,
^ rm_detail_t *, size_t, regmatch_t [], int);
^ #endif
*/
@@ -248,7 +220,7 @@ typedef struct {
/*
* misc generics (may be more functions here eventually)
- ^ re_void regfree(regex_t *);
+ ^ void regfree(regex_t *);
*/
/*
@@ -260,7 +232,7 @@ typedef struct {
* of character is used for error reports is independent of what kind is used
* in matching.
*
- ^ extern size_t regerror(int, __REG_CONST regex_t *, char *, size_t);
+ ^ extern size_t regerror(int, const regex_t *, char *, size_t);
*/
#define REG_OKAY 0 /* no errors detected */
#define REG_NOMATCH 1 /* failed to match */
@@ -293,25 +265,25 @@ typedef struct {
/* automatically gathered by fwd; do not hand-edit */
/* === regproto.h === */
#ifndef __REG_NOCHAR
-int re_comp(regex_t *, __REG_CONST char *, size_t, int);
+int re_comp(regex_t *, const char *, size_t, int);
#endif
#ifndef __REG_NOFRONT
-int regcomp(regex_t *, __REG_CONST char *, int);
+int regcomp(regex_t *, const char *, int);
#endif
#ifdef __REG_WIDE_T
-MODULE_SCOPE int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int);
+MODULE_SCOPE int __REG_WIDE_COMPILE(regex_t *, const __REG_WIDE_T *, size_t, int);
#endif
#ifndef __REG_NOCHAR
-int re_exec(regex_t *, __REG_CONST char *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
+int re_exec(regex_t *, const char *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
#endif
#ifndef __REG_NOFRONT
-int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int);
+int regexec(regex_t *, const char *, size_t, regmatch_t [], int);
#endif
#ifdef __REG_WIDE_T
-MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
+MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
#endif
-MODULE_SCOPE re_void regfree(regex_t *);
-MODULE_SCOPE size_t regerror(int, __REG_CONST regex_t *, char *, size_t);
+MODULE_SCOPE void regfree(regex_t *);
+MODULE_SCOPE size_t regerror(int, const regex_t *, char *, size_t);
/* automatically gathered by fwd; do not hand-edit */
/* =====^!^===== end forwards =====^!^===== */
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 5c65a3c..4020445 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -269,18 +269,6 @@ static int Iso88591ToUtfProc(ClientData clientData,
Tcl_EncodingState *statePtr, char *dst,
int dstLen, int *srcReadPtr, int *dstWrotePtr,
int *dstCharsPtr);
-#if TCL_UTF_MAX > 4
-static int Utf16ToUtfProc(ClientData clientData,
- const char *src, int srcLen, int flags,
- Tcl_EncodingState *statePtr, char *dst, int dstLen,
- int *srcReadPtr, int *dstWrotePtr,
- int *dstCharsPtr);
-static int UtfToUtf16Proc(ClientData clientData,
- const char *src, int srcLen, int flags,
- Tcl_EncodingState *statePtr, char *dst, int dstLen,
- int *srcReadPtr, int *dstWrotePtr,
- int *dstCharsPtr);
-#endif
/*
* A Tcl_ObjType for holding a cached Tcl_Encoding in the twoPtrValue.ptr1 field
@@ -590,32 +578,14 @@ TclInitEncodingSubsystem(void)
type.clientData = NULL;
Tcl_CreateEncoding(&type);
-#if TCL_UTF_MAX > 4
- type.encodingName = "utf-32";
-#else
type.encodingName = "unicode";
-#endif
type.toUtfProc = UnicodeToUtfProc;
type.fromUtfProc = UtfToUnicodeProc;
type.freeProc = NULL;
-#if TCL_UTF_MAX > 4
- type.nullSize = 4;
-#else
type.nullSize = 2;
-#endif
type.clientData = NULL;
Tcl_CreateEncoding(&type);
-#if TCL_UTF_MAX > 4
- type.encodingName = "unicode";
- type.toUtfProc = Utf16ToUtfProc;
- type.fromUtfProc = UtfToUtf16Proc;
- type.freeProc = NULL;
- type.nullSize = 2;
- type.clientData = NULL;
- Tcl_CreateEncoding(&type);
-#endif
-
/*
* Need the iso8859-1 encoding in order to process binary data, so force
* it to always be embedded. Note that this encoding *must* be a proper
@@ -1472,8 +1442,8 @@ Tcl_UtfToExternal(
*
* Tcl_InitSubsystems/Tcl_FindExecutable --
*
- * This function initializes everything needed for the Tcl library
- * to be able to operate.
+ * This function initializes everything needed for the Tcl library
+ * to be able to operate.
*
* Results:
* None.
@@ -1488,7 +1458,7 @@ MODULE_SCOPE const TclStubs tclStubs;
static const struct {
const TclStubs *stubs;
- const char version[12];
+ const char version[16];
} stubInfo = {
&tclStubs, TCL_PATCH_LEVEL
};
@@ -3033,212 +3003,6 @@ Iso88591FromUtfProc(
return result;
}
-#if TCL_UTF_MAX > 4
-/*
- *-------------------------------------------------------------------------
- *
- * Utf16ToUtfProc --
- *
- * Convert from UTF-16 to UTF-8.
- *
- * Results:
- * Returns TCL_OK if conversion was successful.
- *
- * Side effects:
- * None.
- *
- *-------------------------------------------------------------------------
- */
-
-static int
-Utf16ToUtfProc(
- ClientData clientData, /* Not used. */
- const char *src, /* Source string in Unicode. */
- int srcLen, /* Source string length in bytes. */
- int flags, /* Conversion control flags. */
- Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
- * information used during a piecewise
- * conversion. Contents of statePtr are
- * initialized and/or reset by conversion
- * routine under control of flags argument. */
- char *dst, /* Output buffer in which converted string is
- * stored. */
- int dstLen, /* The maximum length of output buffer in
- * bytes. */
- int *srcReadPtr, /* Filled with the number of bytes from the
- * source string that were converted. This may
- * be less than the original source length if
- * there was a problem converting some source
- * characters. */
- int *dstWrotePtr, /* Filled with the number of bytes that were
- * stored in the output buffer as a result of
- * the conversion. */
- int *dstCharsPtr) /* Filled with the number of characters that
- * correspond to the bytes stored in the
- * output buffer. */
-{
- const char *srcStart, *srcEnd;
- const char *dstEnd, *dstStart;
- int result, numChars, charLimit = INT_MAX;
- Tcl_UniChar ch;
-
- if (flags & TCL_ENCODING_CHAR_LIMIT) {
- charLimit = *dstCharsPtr;
- }
- result = TCL_OK;
- if ((srcLen % sizeof(unsigned short)) != 0) {
- result = TCL_CONVERT_MULTIBYTE;
- srcLen /= sizeof(unsigned short);
- srcLen *= sizeof(unsigned short);
- }
-
- srcStart = src;
- srcEnd = src + srcLen;
-
- dstStart = dst;
- dstEnd = dst + dstLen - sizeof(unsigned short);
-
- for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) {
- if (dst > dstEnd) {
- result = TCL_CONVERT_NOSPACE;
- break;
- }
- ch = *(unsigned short *)src;
- if (ch && ch < 0x80) {
- *dst++ = (ch & 0xFF);
- } else if ((ch >= 0xD800) && (ch <= 0xDBFF)) {
- Tcl_UniChar ch2 = *(unsigned short *)(src + sizeof(unsigned short));
-
- if ((ch2 >= 0xDC00) && (ch2 <= 0xDFFF)) {
- ch = ((ch & 0x3FF) << 10) + 0x10000 + (ch2 & 0x3FF);
- src += sizeof(unsigned short);
- }
- dst += Tcl_UniCharToUtf(ch, dst);
- } else {
- dst += Tcl_UniCharToUtf(ch, dst);
- }
- src += sizeof(unsigned short);
- }
-
- *srcReadPtr = src - srcStart;
- *dstWrotePtr = dst - dstStart;
- *dstCharsPtr = numChars;
- return result;
-}
-#endif
-
-#if TCL_UTF_MAX > 4
-/*
- *-------------------------------------------------------------------------
- *
- * UtfToUtf16Proc --
- *
- * Convert from UTF-8 to UTF-16.
- *
- * Results:
- * Returns TCL_OK if conversion was successful.
- *
- * Side effects:
- * None.
- *
- *-------------------------------------------------------------------------
- */
-
-static int
-UtfToUtf16Proc(
- ClientData clientData, /* TableEncodingData that specifies
- * encoding. */
- const char *src, /* Source string in UTF-8. */
- int srcLen, /* Source string length in bytes. */
- int flags, /* Conversion control flags. */
- Tcl_EncodingState *statePtr,/* Place for conversion routine to store state
- * information used during a piecewise
- * conversion. Contents of statePtr are
- * initialized and/or reset by conversion
- * routine under control of flags argument. */
- char *dst, /* Output buffer in which converted string is
- * stored. */
- int dstLen, /* The maximum length of output buffer in
- * bytes. */
- int *srcReadPtr, /* Filled with the number of bytes from the
- * source string that were converted. This may
- * be less than the original source length if
- * there was a problem converting some source
- * characters. */
- int *dstWrotePtr, /* Filled with the number of bytes that were
- * stored in the output buffer as a result of
- * the conversion. */
- int *dstCharsPtr) /* Filled with the number of characters that
- * correspond to the bytes stored in the
- * output buffer. */
-{
- const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd;
- int result, numChars;
- Tcl_UniChar ch;
-
- srcStart = src;
- srcEnd = src + srcLen;
- srcClose = srcEnd;
- if ((flags & TCL_ENCODING_END) == 0) {
- srcClose -= TCL_UTF_MAX;
- }
-
- dstStart = dst;
- dstEnd = dst + dstLen - 2 * sizeof(unsigned short);
-
- result = TCL_OK;
- for (numChars = 0; src < srcEnd; numChars++) {
- if ((src > srcClose) && (!Tcl_UtfCharComplete(src, srcEnd - src))) {
- /*
- * If there is more string to follow, this will ensure that the
- * last UTF-8 character in the source buffer hasn't been cut off.
- */
-
- result = TCL_CONVERT_MULTIBYTE;
- break;
- }
- if (dst > dstEnd) {
- result = TCL_CONVERT_NOSPACE;
- break;
- }
- src += TclUtfToUniChar(src, &ch);
-
- if (ch > 0x10FFFF) {
- ch = 0xFFFD;
- }
-
- /*
- * Need to handle this in a way that won't cause misalignment by
- * casting dst to a Tcl_UniChar. [Bug 1122671]
- */
-
- if (ch > 0xFFFF) {
- int high = (((ch - 0x10000) >> 10) & 0x3FF) | 0xD800;
-
- ch = ((ch - 0x10000) & 0x3FF) | 0xDC00;
-#ifdef WORDS_BIGENDIAN
- *dst++ = ((high >> 8) & 0xFF);
- *dst++ = (high & 0xFF);
-#else
- *dst++ = (high & 0xFF);
- *dst++ = ((high >> 8) & 0xFF);
-#endif
- }
-#ifdef WORDS_BIGENDIAN
- *dst++ = ((ch >> 8) & 0xFF);
- *dst++ = (ch & 0xFF);
-#else
- *dst++ = (ch & 0xFF);
- *dst++ = ((ch >> 8) & 0xFF);
-#endif
- }
- *srcReadPtr = src - srcStart;
- *dstWrotePtr = dst - dstStart;
- *dstCharsPtr = numChars;
- return result;
-}
-#endif
-
/*
*---------------------------------------------------------------------------
*
diff --git a/unix/Makefile.in b/unix/Makefile.in
index c09fb35..3e4cfc7 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -1835,7 +1835,7 @@ gendate:
# -e 's?SCCSID?RCS: @(#) ?' \
# -e '/#ifdef __STDC__/,/#endif/d' -e '/TclDateerrlab:/d' \
# -e '/TclDatenewstate:/d' -e '/#pragma/d' \
-# -e '/#include <inttypes.h>/d' -e 's/const /CONST /g' \
+# -e '/#include <inttypes.h>/d' \
# -e '/#define YYNEW/s/malloc/TclDateAlloc/g' \
# -e '/#define YYENLARGE/,/realloc/s/realloc/TclDateRealloc/g' \
# <y.tab.c >$(GENERIC_DIR)/tclDate.c
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index cca0dab..78b510b 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -95,7 +95,7 @@ static void FileThreadActionProc(ClientData instanceData,
static int FileTruncateProc(ClientData instanceData,
Tcl_WideInt length);
static DWORD FileGetType(HANDLE handle);
-static int NativeIsComPort(CONST TCHAR *nativeName);
+static int NativeIsComPort(const TCHAR *nativeName);
/*
* This structure describes the channel type structure for file based IO.
*/