summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
Commit message (Collapse)AuthorAgeFilesLines
* various "const" additions, in line with TIP #27nijtmans2007-02-231-69/+69
|
* Missed a spot; thanks to Andreas Kupries for spotting this one.dkf2007-01-171-5/+10
|
* Added macros to make usage of ChannelBuffers clearer.dkf2007-01-171-81/+128
|
* * generic/tclIO.c (Tcl_GetsObj):mdejong2006-12-271-14/+20
| | | | | Avoid checking for for the LF in a possible CRLF sequence when EOF has already been found.
* * generic/tclIO.c: When [gets] on a binary channel needs to usedgp2006-11-131-12/+41
| | | | | | | the "iso8859-1" encoding, save a copy of that encoding per-thread to avoid repeated freeing and re-loading of it from the file system. This replaces the cached copy of this encoding that the platform initialization code used to keep in pre-8.5 releases.
* * generic/tclCompExpr.c: fix gcc warnings about 'cast to/fromdas2006-11-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | * generic/tclEncoding.c: pointer from/to integer of different * generic/tclEvent.c: size' on 64-bit platforms by casting to * generic/tclExecute.c: intermediate types intptr_t/uintptr_t * generic/tclHash.c: via new PTR2INT(), INT2PTR(), * generic/tclIO.c: PTR2UINT() and UINT2PTR() macros. * generic/tclInt.h: [Patch 1592791] * generic/tclProc.c: * generic/tclTest.c: * generic/tclThreadStorage.c: * generic/tclTimer.c: * generic/tclUtil.c: * unix/configure.in: * unix/tclUnixChan.c: * unix/tclUnixPipe.c: * unix/tclUnixPort.h: * unix/tclUnixTest.c: * unix/tclUnixThrd.c: * unix/configure: autoconf-2.59 * unix/tclConfig.h.in: autoheader-2.59
* Rewrite for style and clarity (esp. tclPkg.c)dkf2006-11-081-231/+275
|
* * generic/tclIO.c (Tcl_GetsObj): added two test'n'panic guards forMiguel Sofer2006-09-281-1/+7
| | | | possible NULL derefs, [Bug 1566382] and coverity #33.
* * generic/tclIO.c (Tcl_StackChannel): Fixed [SF Tcl Bug 1564642],andreas_kupries2006-09-251-2/+2
| | | | | aka coverity #51. Extended loop condition, added checking for NULL to prevent seg.fault.
* * generic/tclIO.c (ReadChars): Added check and panic andandreas_kupries2006-04-051-1/+76
| | | | | | | | | | | | | | | | | | | | | commentary to a piece of code which relies on BUFFER_PADDING to create enough space at the beginning of each buffer forthe insertion of partial multi-byte data at the beginning of a buffer. To explain why this code is ok, and as precaution if someone twiddled the BUFFER_PADDING into uselessness. * generic/tclIO.c (ReadChars): [SF Tcl Bug 1462248]. Added code temporarily suppress the use of TCL_ENCODING_END set when eof was reached while the buffer we are converting is not truly the last buffer in the queue. together with the Utf bug below it was possible to completely bollox the buffer data structures, eventually crashing Tcl. * generic/tclEncoding.c (UtfToUtfProc): Fixed problem where the function accessed memory beyond the end of the input buffer. When TCL_ENCODING_END is set and the last bytes of the buffer start a multi-byte sequence. This bug contributed to [SF Tcl Bug 1462248].
* * doc/CrtChannel.3: Added TCL_CHANNEL_VERSION_5, made itandreas_kupries2006-03-271-2/+4
| | | | | | | | | | | | | | * generic/tcl.h: the version where the "truncateProc" * generic/tclIO.c: is defined at, and moved all channel * generic/tclIOGT.c: drivers of Tcl to v5. * generic/tclIORChan.c: * unix/tclUnixChan.c: * unix/tclUnixPipe.c: * win/tclWinChan.c: * win/tclWinConsole.c: * win/tclWinPipe.c: * win/tclWinSerial.c: * win/tclWinSock.c:
* Calls TclpFinalizeSockets() as partvasiljevic2006-03-101-1/+8
| | | | of the TclFinalizeIOSubsystem()
* * generic/tclIO.c: Made several routines tolerant ofdgp2006-02-151-23/+39
| | | | | * generic/tclIORChan.c: interp == NULL arguments. [Bug 1380662] * generic/tclIOUtil.c:
* Export stubs for libtommath; fix mingw compiler warningsKevin B Kenny2005-12-131-2/+2
|
* * generic/tclIO.c (TclFinalizeIOSubsystem): preserve statePtrhobbs2005-11-181-5/+10
| | | | until we netrieve next statePtr from it.
* * generic/tclIO.c (TclFinalizeIOSubsystem): Applied Pat Thoyts'andreas_kupries2005-11-181-2/+6
| | | | | | | patch for [SF Tcl Bug 1359094]. This moves the retrieval of the next channel state to the end of the loop, as the called closeproc may close other channels, i.e. modify the list we are iterating, invalidating any pointer retrieved earlier.
* typodgp2005-10-311-2/+2
|
* Convert to using ANSI decls/definitions and using the (ANSI) assumption that ↵dkf2005-10-311-1162/+1126
| | | | | | NULL can be cast to any pointer type transparently.
* Backed off change from 2005-10-04 (see ChangeLog and Tcl Bug# 1323992vasiljevic2005-10-141-13/+1
| | | | for more info).
* Added some more clarifying comments in Tcl_ClearChannelHandlers()vasiljevic2005-10-131-7/+6
|
* Temporary ifdef TCL_THREADS changes done to de-activate pendingvasiljevic2005-10-131-1/+8
| | | | event processing when channel is being closed/cutted.
* Tcl_ClearChannelHandlers(): now deletes any outstandingvasiljevic2005-10-041-6/+18
| | | | | timer for the channel. Also, prevents events still in the event queue from triggering on the current channel.
* * generic/tclIO.c: Moved Tcl_{Cut,Splice}Channel toandreas_kupries2005-08-261-9/+147
| | | | | | | | | {Cut,Splice}Channel for internal use, and created new public functions for Tcl_{Cut,Splice}Channel which walk the whole stack of transformations and invoke the necessary thread actions. Added code to Tcl_(Un)StackChannel to properly invoke the thread actions when pushing and popping transformations on/from a channel.
* TIP#219 IMPLEMENTATIONandreas_kupries2005-08-241-25/+444
| | | | | | | | | | | | | | | | | | | | | | | | | | * doc/SetChanErr.3: ** New File **. Documentation of the new channel API functions. * generic/tcl.decls: Stub declarations of the new channel API. * generic/tclDecls.h: Regenerated * generic/tclStubInit.c: * tclIORChan.c: ** New File **. Implementation of the reflected channel. * generic/tclInt.h: Integration of reflected channel and new error * generic/tclIO.c: propagation into the generic I/O core. * generic/tclIOCmd.c: * generic/tclIO.h: * library/init.tcl: * tests/io.test: Extended testsuite. * tests/ioCmd.test: * tests/chan.test: * generic/tclTest.c: * generic/tclThreadTest.c: * unix/Makefile.in: Integration into the build machinery. * win/Makefile.in: * win/Makefile.vc:
* * generic/tclIO.c (CloseChannel): Fixed comment nit, addedandreas_kupries2005-08-041-2/+2
| | | | | | | apparently missing word to complete a sentence. * generic/tclObj.c (Tcl_DbDecrRefCount): Fixed whitespace nit in panic message.
* Getting more systematic about styledkf2005-07-171-1619/+1564
|
* bug 1225727Kevin B Kenny2005-06-221-1/+2
|
* Stick to TCL_CHANNEL_VERSION_4; it's all in alpha anyway!dkf2005-06-071-2/+19
|
* typodgp2005-06-071-2/+2
|
* TIP#208 implementationdkf2005-06-061-1/+83
| | | | It's crude (especially in the tests and docs department) and incomplete (no truncation on non-POSIX platforms).
* Merged kennykb-numerics-branch back to the head; TIPs 132 and 232Kevin B Kenny2005-05-101-1/+1
|
* * generic/tclInt.decls: Converted TclMatchIsTrivial to a macro.dgp2005-05-051-2/+13
| | | | | | | | | | | | | | * generic/tclInt.h: * generic/tclUtil.c: * generic/tclIntDecls.h: `make genstubs` * generic/tclStubInit.c: * generic/tclBasic.c: Added callers of TclMatchIsTrivial where * generic/tclCmdIL.c: a search can be done more efficiently * generic/tclCompCmds.c:when it is recognized that a pattern match * generic/tclDictObj.c: is really an exact match. [Patch 1076088] * generic/tclIO.c: * generic/tclNamesp.c: * generic/tclVar.c:
* * generic/tclIO.c (Tcl_SetChannelBufferSize): Lowest size limitdavygrvy2005-04-141-4/+4
| | | | | | | | | * tests/io.test: changed from ten bytes to one byte. Need for this change was proven by Ross Cartlidge <rossc@cisco.com> where [read stdin 1] was grabbing 10 bytes followed by starting a child process that was intended to continue reading from stdin. Even with -buffersize set to one, nine chars were getting lost by buffer size over reading for the native read().
* explanatory commentdgp2005-04-081-1/+8
|
* TIP#218 IMPLEMENTATIONandreas_kupries2005-01-271-19/+60
| | | | | | | | | | | | | | | | | | | | * generic/tclDecls.h: Regenerated from tcl.decls. * generic/tclStubInit.c: * doc/CrtChannel.3: Documentation of extended API, * generic/tcl.decls: extended testsuite, and * generic/tcl.h: implementation. Removal of old * generic/tclIO.c: driver-specific TclpCut/Splice * generic/tclInt.h: functions. Replaced with generic * tests/io.test: thread-action calls through the * unix/tclUnixChan.c: new hooks. Update of all builtin * unix/tclUnixPipe.c: channel drivers to version 4. * unix/tclUnixSock.c: Windows drivers extended to * win/tclWinChan.c: manage thread state in a thread * win/tclWinConsole.c: action handler. * win/tclWinPipe.c: * win/tclWinSerial.c: * win/tclWinSock.c:
* Patch 976520 reworks several of the details involved withdgp2004-11-301-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | startup/initialization of the Tcl library, focused on the activities of Tcl_FindExecutable(). * generic/tclIO.c: Removed bogus claim in comment that encoding "iso8859-1" is "built-in" to Tcl. * generic/tclInt.h: Created a new struct ProcessGlobalValue, * generic/tclUtil.c: routines Tcl(Get|Set)ProcessGlobalValue, and function type TclInitProcessGlobalValueProc. Together, these take care of the housekeeping for "values" (things that can be held in a Tcl_Obj) that are global across a whole process. That is, they are shared among multiple threads, and epoch and mutex protection must govern the validity of cached copies maintained in each thread. * generic/tclNotify.c: Modified TclInitNotifier() to tolerate being called multiple times in the same thread. * generic/tclEvent.c: Dropped the unused argv0 argument to TclInitSubsystems(). Removed machinery to unsure only one TclInitNotifier() call per thread, now that that is safe. Converted Tcl(Get|Set)LibraryPath to use a ProcessGlobalValue, and moved them to tclEncoding.c. * generic/tclBasic.c: Updated caller. * generic/tclInt.h: TclpFindExecutable now returns void. * unix/tclUnixFile.c: * win/tclWinFile.c: * win/tclWinPipe.c: * generic/tclEncoding.c: Built new encoding search initialization on a foundation of ProcessGlobalValues, exposing new routines Tcl(Get|Set)EncodingSearchPath. A cache of a map from encoding name to directory pathname keeps track of where encodings are available for loading. Tcl_FindExecutable greatly simplified into just three function calls. The "library path" is now misnamed, as its only remaining purpose is as a foundation for the default encoding search path. * generic/tclInterp.c: Inlined the initScript that is evaluated by Tcl_Init(). Added verification after initScript evaluation that Tcl can find its installed *.enc files, and that it has initialized [encoding system] in agreement with what the environment expects. [tclInit] no longer driven by the value of $::tcl_libPath; it largely constructs its own search path now, rather than attempt to share one with the encoding system. * unix/tclUnixInit.c: TclpSetInitialEncodings factored so that a new * win/tclWinInit.c: routine TclpGetEncodingNameFromEnvironment can reveal that Tcl thinks the [encoding system] should be, even when an incomplete encoding search path, or a missing *.enc file won't allow that initialization to succeed. TclpInitLibraryPath reworked as an initializer of a ProcessGlobalValue. * unix/tclUnixTest.c: Update implementations of [testfindexecutable], [testgetdefenc], and [testsetdefenc]. * tests/unixInit.test: Corrected tests to operate properly even when a value of TCL_LIBRARY is required to find encodings. * generic/tclInt.decls: New internal stubs: TclGetEncodingSearchPath, TclSetEncodingSearchPath, TclpGetEncodingNameFromEnvironment. These are candidates for public exposure by future TIPs. * generic/tclIntDecls.h: make genstubs * generic/tclStubInit.c: * generic/tclTest.c: Updated [testencoding] to use * tests/encoding.test: Tcl(Get|Set)EncodingSearchPath. Updated tests.
* Janitorial whitespace/style fixes.dkf2004-11-091-1423/+1455
|
* * generic/tclBasic.c:dgp2004-10-061-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclBinary.c: * generic/tclCmdAH.c: * generic/tclCmdIL.c: * generic/tclCmdMZ.c: * generic/tclCompExpr.c: * generic/tclDictObj.c: * generic/tclEncoding.c: * generic/tclExecute.c: * generic/tclFCmd.c: * generic/tclHistory.c: * generic/tclIndexObj.c: * generic/tclInterp.c: * generic/tclIO.c: * generic/tclIOCmd.c: * generic/tclNamesp.c: * generic/tclObj.c: * generic/tclPkg.c: * generic/tclResult.c: * generic/tclScan.c: * generic/tclTimer.c: * generic/tclTrace.c: * generic/tclUtil.c: * generic/tclVar.c: It is a poor practice to directly set or append to the value of the objResult of an interp, because that value might be shared, and in that circumstance a Tcl_Panic() will be the result. Searched for example of this practice and replaced with safer alternatives, often using the Tcl_AppendResult() routine that dkf just rehabilitated.
* Fix [Bug 1025359]; make sure wide seeks don't lose errorsdkf2004-09-101-5/+5
|
* * generic/tclIO.h (CHANNEL_INCLOSE): New flag. Set inandreas_kupries2004-07-151-1/+45
| | | | | | | | | | | | | | | | | | | | | | * generic/tclIO.c (Tcl_UnregisterChannel): 'Tcl_Close' while the * generic/tclIO.c (Tcl_Close): close callbacks are run. Checked in 'Tcl_Close' and 'Tcl_Unregister' to prevent recursive call of 'close' in the close-callbacks. This is a possible error made by implementors of virtual filesystems based on 'tclvfs', thinking that they have to close the channel in the close handler for the filesystem. * generic/tclIO.c: * generic/tclIO.h: * Not reverting, but #ifdef'ing the changes from May 19, 2004 out of the core. This removes the ***POTENTIAL INCOMPATIBILITY*** for channel drivers it introduced. This has become possible due to Expect gaining a BlockModeProc and now handling blockingg and non-blocking modes correctly. Thus [SF Tcl Bug 943274] is still fixed if a recent enough version of Expect is used. * doc/CrtChannel.3: Added warning about usage of a channel without a BlockModeProc.
* * generic/tclIO.c (Tcl_SetChannelOption): Took out the rangedavygrvy2004-06-011-9/+1
| | | | | | | verification on -buffersize so original behavior for silently ignoring bad settings is returned. The only difference now is the behavior difference between atoi and Tcl_GetInt which gains the ability to error for 'not a number' and can understand hexidecimal.
* * generic/tclIO.c (Tcl_SetChannelOption): Invalid settingsdavygrvy2004-06-011-3/+14
| | | | | | for -buffersize weren't being reported as errors and were blindly ignored. Now reports conversion errors to an int and checks ranges for validity. atoi() swapped for Tcl_GetInt().
* * tclIO.c: Fixed [SF Tcl Bug 943274]. This is the same problem asandreas_kupries2004-05-191-6/+89
| | | | | | | | | | | | | * tclIO.h: [SF Tcl Bug 462317], see ChangeLog entry 2001-09-26. The fix done at that time is incomplete. It is possible to get around it if the actual read operation is defered and not executed in the event handler itself. Instead of tracking if we are in an read caused by a synthesized fileevent we now track if the OS has delivered a true event = actual data and bypass the driver if a read finds that there is no actual data waiting. The flag is cleared by a short or full read.
* * generic/tclIO.c (Tcl_SetChannelOption): Fixed [SF Tcl Bugandreas_kupries2004-04-231-1/+10
| | | | | 930851]. When changing the eofchar we have to zap the related flags to prevent them from prematurely aborting the next read.
* Patch 922727 committed. Implements three changes:dgp2004-04-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | * generic/tclInt.h: Reworked the Tcl header files into a clean * unix/tclUnixPort.h: hierarchy where tcl.h < tclPort.h < tclInt.h * win/tclWinInt.h: and every C source file should #include * win/tclWinPort.h: at most one of those files to satisfy its declaration needs. tclWinInt.h and tclWinPort.h also better organized so that tclWinPort.h includes the Windows implementation of cross-platform declarations, while tclWinInt.h makes declarations that are available on Windows only. * generic/tclBinary.c (TCL_NO_MATH): Deleted the generic/tclMath.h * generic/tclMath.h (removed): header file. The internal Tcl * macosx/Makefile (PRIVATE_HEADERS): header, tclInt.h, has a * win/tcl.dsp: #include <math.h> directly, and file external to Tcl needing libm should do the same. * win/Makefile.in (WIN_OBJS): Deleted the win/tclWinMtherr.c file. * win/makefile.bc (TCLOBJS): It's a vestige from matherr() days * win/makefile.vc (TCLOBJS): gone by. * win/tcl.dsp: * win/tclWinMtherr.c (removed):
* fixed typos in documentation and commentsvincentdarley2004-03-091-4/+4
|
* * generic/tclIO.c (Tcl_Ungets): fixed improper filling of the channel buffer.davygrvy2004-02-021-3/+2
| | | | [Bug 405995]
* All uses of 'panic' (the macro) changeddavygrvy2003-12-241-12/+12
| | | | | | | to 'Tcl_Panic' (the function). The #define of panic in tcl.h clearly states it is deprecated in the comments. [Patch 865264]
* * The changes below fix SF bugs [593810], and [718045].andreas_kupries2003-04-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclIO.c (Tcl_CutChannel, Tcl_SpliceChannel): Invoke TclpCutSockChannel and TclpSpliceSockChannel. * generic/tclInt.h: Declare TclpCutSockChannel and TclpSpliceSockChannel. * unix/tclUnixSock.c (TclpCutSockChannel, TclpSpliceSockChannel): Dummy functions, on unix the sockets are _not_ handled specially. * mac/tclMacSock.c (TclpCutSockChannel, TclpSpliceSockChannel): * win/tclWinSock.c (TclpCutSockChannel, TclpSpliceSockChannel): New functions to handle socket specific cut/splice operations: auto-initi of socket system for thread on splice, management of the module internal per-thread list of sockets, management of association of sockets with HWNDs for event notification. * win/tclWinSock.c (NewSocketInfo): Extended initialization assignments to cover all items of the structure. During debugging of the new code mentioned above I found that two fileds could contain bogus data. * win/tclWinFile.c: Added #undef HAVE_NO_FINDEX_ENUMS before definition because when compiling in debug mode the compiler complains about a redefinition, and this warning is also treated as an error.
* * generic/tclIO.c (UpdateInterest): When dropping interest inandreas_kupries2003-04-111-1/+44
| | | | | | | TCL_READABLE now dropping interest in TCL_EXCEPTION too. This fixes a bug where Expect detects eof on a file prematurely on solaris 2.6 and higher. A much more complete explanation is in the code itself (40 lines of comments for a one-line change :)