Manifest of check-in
[7cefe002e7]
- Add two new (undocumented) flags to the Tcl_ExternalToUtf() interface.
TCL_ENCODING_NO_TERMINATE rejects the default behavior of appending a
terminating NUL byte to the produced Utf output. This permits use of all
of the dstLen bytes provided, and simplifies the buffer size calculations
demanded from callers. Perhaps some callers need or appreciate this default
behavior, but for Tcl's own main use of encodings - conversions within I/O -
this just gets in the way.
TCL_ENCODING_CHAR_LIMIT lets the caller set a limit on the number of chars
to be output to be enforced by the encoding routines themselves. Without
this, callers have to check after the fact for going beyond limits and
make multiple encoding calls in a trial and error approach.
Full compatibility is supported. No defaults are changed, and the flags
have their effect even if an encoding driver has not been written to support
these flags (but greater efficiency is enjoyed if they do!).
All of Tcl's own encoding drivers are updated to support this. Other encoding
drivers may exist somewhere, but I cannot point to any.
A TIP to document this and make it officially supported may come in time.
by
dgp on
2014-12-23 18:39:35.
B 753ce11db44b4ae1dd6b3454f6a78538643323a6
C Add\stwo\snew\s(undocumented)\sflags\sto\sthe\sTcl_ExternalToUtf()\sinterface.\nTCL_ENCODING_NO_TERMINATE\srejects\sthe\sdefault\sbehavior\sof\sappending\sa\nterminating\sNUL\sbyte\sto\sthe\sproduced\sUtf\soutput.\s\sThis\spermits\suse\sof\sall\nof\sthe\sdstLen\sbytes\sprovided,\sand\ssimplifies\sthe\sbuffer\ssize\scalculations\ndemanded\sfrom\scallers.\s\sPerhaps\ssome\scallers\sneed\sor\sappreciate\sthis\sdefault\nbehavior,\sbut\sfor\sTcl's\sown\smain\suse\sof\sencodings\s-\sconversions\swithin\sI/O\s-\nthis\sjust\sgets\sin\sthe\sway.\nTCL_ENCODING_CHAR_LIMIT\slets\sthe\scaller\sset\sa\slimit\son\sthe\snumber\sof\schars\nto\sbe\soutput\sto\sbe\senforced\sby\sthe\sencoding\sroutines\sthemselves.\s\sWithout\nthis,\scallers\shave\sto\scheck\safter\sthe\sfact\sfor\sgoing\sbeyond\slimits\sand\nmake\smultiple\sencoding\scalls\sin\sa\strial\sand\serror\sapproach.\nFull\scompatibility\sis\ssupported.\s\sNo\sdefaults\sare\schanged,\sand\sthe\sflags\nhave\stheir\seffect\seven\sif\san\sencoding\sdriver\shas\snot\sbeen\swritten\sto\ssupport\nthese\sflags\s(but\sgreater\sefficiency\sis\senjoyed\sif\sthey\sdo!).\nAll\sof\sTcl's\sown\sencoding\sdrivers\sare\supdated\sto\ssupport\sthis.\s\sOther\sencoding\ndrivers\smay\sexist\ssomewhere,\sbut\sI\scannot\spoint\sto\sany.\nA\sTIP\sto\sdocument\sthis\sand\smake\sit\sofficially\ssupported\smay\scome\sin\stime.
D 2014-12-23T18:39:35.633
F changes 037ff6ce90f455ef2ba9d35151a2c386dd65e9e3
F doc/socket.n ea5710f3dd510d8ab3fd10c3f8143dc6ff871f94
F generic/tcl.h 09f6cbfaac5111a87b683a45047f2d141b03f5bc
F generic/tclCompCmds.c 13bb4356cd15f635a5e6f9e1d7aaff6eb9879224
F generic/tclCompCmdsGR.c 1fa2e32e0738a53fc3a3a3a47a400a105f8b9176
F generic/tclCompile.h a9edc8f27dd58226bf97c87b87608f9898d59366
F generic/tclEncoding.c 650078c0751de9d50b5882761f894655d6f0140b
F generic/tclEvent.c 6a325581bbdb94a754b89a9dcaf46c157d393f3b
F generic/tclIO.c eab4d1aba5c558e5e341cb93c9f01e2d15f7cc10
F generic/tclInt.h 49be15c5df455f67b546ff8521d7fd29088a3fea
F generic/tclParse.c 3d1e4087ae8a988d7b486cb8cb6855d000363abe
F generic/tclThread.c aa7d90de72a94c18d02265fc3fc390bf7052422a
F macosx/GNUmakefile 5c41d984df8b5dca7c72174f552c82bc3844a94d
F tests/io.test 5736095ae63953e4bcb7780aaf6a0af24495b7be
F tests/ioCmd.test 07ffddb5fc8af00fc741daf907ca42575f408750
F unix/tclUnixSock.c 0ff0e4c03a269751171fe2113c292e07e39b91c6
F win/README f783ead8576ad16c3374054db2fd939c0e332b76
F win/tclWinSock.c 9d301fe10da3b5c44c956d7b342a755a94acd6dd
P d9a4be6a301d57eb16e7ea26323e353ed9b62e97 14b0ab81bbdb023f8bcab43ed1a045bbd112cc97
R 70d04d62c2176d672b04c110b0012cca
U dgp
Z 499f2b874c86c878a61ab8cb45fa76a9