diff options
Diffstat (limited to 'generic/tclIORChan.c')
| -rw-r--r-- | generic/tclIORChan.c | 104 |
1 files changed, 53 insertions, 51 deletions
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 88f6de8..ec82fc5 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -31,35 +31,35 @@ * Signatures of all functions used in the C layer of the reflection. */ -static int ReflectClose(ClientData clientData, +static int ReflectClose(void *clientData, Tcl_Interp *interp, int flags); -static int ReflectInput(ClientData clientData, char *buf, +static int ReflectInput(void *clientData, char *buf, int toRead, int *errorCodePtr); -static int ReflectOutput(ClientData clientData, const char *buf, +static int ReflectOutput(void *clientData, const char *buf, int toWrite, int *errorCodePtr); -static void ReflectWatch(ClientData clientData, int mask); -static int ReflectBlock(ClientData clientData, int mode); +static void ReflectWatch(void *clientData, int mask); +static int ReflectBlock(void *clientData, int mode); #if TCL_THREADS -static void ReflectThread(ClientData clientData, int action); +static void ReflectThread(void *clientData, int action); static int ReflectEventRun(Tcl_Event *ev, int flags); -static int ReflectEventDelete(Tcl_Event *ev, ClientData cd); +static int ReflectEventDelete(Tcl_Event *ev, void *cd); #endif -static long long ReflectSeekWide(ClientData clientData, +static long long ReflectSeekWide(void *clientData, long long offset, int mode, int *errorCodePtr); #ifndef TCL_NO_DEPRECATED -static int ReflectSeek(ClientData clientData, long offset, +static int ReflectSeek(void *clientData, long offset, int mode, int *errorCodePtr); #endif -static int ReflectGetOption(ClientData clientData, +static int ReflectGetOption(void *clientData, Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); -static int ReflectSetOption(ClientData clientData, +static int ReflectSetOption(void *clientData, Tcl_Interp *interp, const char *optionName, const char *newValue); -static int ReflectTruncate(ClientData clientData, +static int ReflectTruncate(void *clientData, long long length); -static void TimerRunRead(ClientData clientData); -static void TimerRunWrite(ClientData clientData); +static void TimerRunRead(void *clientData); +static void TimerRunWrite(void *clientData); /* * The C layer channel type/driver definition used by the reflection. @@ -80,7 +80,7 @@ static const Tcl_ChannelType tclRChannelType = { ReflectGetOption, /* Get options. NULL'able */ ReflectWatch, /* Initialize notifier */ NULL, /* Get OS handle from the channel. NULL'able */ - ReflectClose, /* No close2 support. NULL'able */ + ReflectClose, /* No close2 support. NULL'able */ ReflectBlock, /* Set blocking/nonblocking. NULL'able */ NULL, /* Flush channel. Not used by core. NULL'able */ NULL, /* Handle events. NULL'able */ @@ -220,7 +220,7 @@ typedef enum { #define IMPLIES(a,b) ((!(a)) || (b)) #define NEGIMPL(a,b) -#define HAS(x,f) (x & FLAG(f)) +#define HAS(x,f) ((x) & FLAG(f)) #if TCL_THREADS /* @@ -408,7 +408,7 @@ TCL_DECLARE_MUTEX(rcForwardMutex) static void ForwardOpToHandlerThread(ReflectedChannel *rcPtr, ForwardedOperation op, const void *param); static int ForwardProc(Tcl_Event *evPtr, int mask); -static void SrcExitProc(ClientData clientData); +static void SrcExitProc(void *clientData); #define FreeReceivedError(p) \ if ((p)->base.mustFree) { \ @@ -507,7 +507,7 @@ static const char *msg_dstlost = "-code 1 -level 0 -errorcode NONE -errorinfo int TclChanCreateObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -616,7 +616,7 @@ TclChanCreateObjCmd( * Compare open mode against optional r/w. */ - if (Tcl_ListObjGetElements(NULL, resObj, &listc, &listv) != TCL_OK) { + if (TclListObjGetElementsM(NULL, resObj, &listc, &listv) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "chan handler \"%s initialize\" returned non-list: %s", TclGetString(cmdObj), TclGetString(resObj))); @@ -809,7 +809,7 @@ ReflectEventRun( static int ReflectEventDelete( Tcl_Event *ev, - ClientData cd) + void *cd) { /* OWNER thread * @@ -829,7 +829,7 @@ ReflectEventDelete( int TclChanPostEventObjCmd( - TCL_UNUSED(ClientData), + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -994,8 +994,8 @@ TclChanPostEventObjCmd( * XXX Actually, in that case the channel should be dead also ! */ - Tcl_ThreadQueueEvent(rcPtr->owner, (Tcl_Event *) ev, TCL_QUEUE_TAIL); - Tcl_ThreadAlert(rcPtr->owner); + Tcl_ThreadQueueEvent(rcPtr->owner, (Tcl_Event *) ev, + TCL_QUEUE_TAIL|TCL_QUEUE_ALERT_IF_EMPTY); } #endif @@ -1012,7 +1012,7 @@ TclChanPostEventObjCmd( static void TimerRunRead( - ClientData clientData) + void *clientData) { ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; rcPtr->readTimer = NULL; @@ -1021,7 +1021,7 @@ TimerRunRead( static void TimerRunWrite( - ClientData clientData) + void *clientData) { ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; rcPtr->writeTimer = NULL; @@ -1072,7 +1072,7 @@ UnmarshallErrorResult( * information; if we panic here, something has gone badly wrong already. */ - if (Tcl_ListObjGetElements(interp, msgObj, &lc, &lv) != TCL_OK) { + if (TclListObjGetElementsM(interp, msgObj, &lc, &lv) != TCL_OK) { Tcl_Panic("TclChanCaughtErrorBypass: Bad syntax of caught result"); } if (interp == NULL) { @@ -1156,7 +1156,7 @@ TclChanCaughtErrorBypass( * ReflectClose -- * * This function is invoked when the channel is closed, to delete the - * driver specific instance data. + * driver-specific instance data. * * Results: * A posix error. @@ -1169,7 +1169,7 @@ TclChanCaughtErrorBypass( static int ReflectClose( - ClientData clientData, + void *clientData, Tcl_Interp *interp, int flags) { @@ -1189,8 +1189,8 @@ ReflectClose( /* * This call comes from TclFinalizeIOSystem. There are no * interpreters, and therefore we cannot call upon the handler command - * anymore. Threading is irrelevant as well. We simply clean up all - * our C level data structures and leave the Tcl level to the other + * anymore. Threading is irrelevant as well. Simply clean up all + * the C level data structures and leave the Tcl level to the other * finalization functions. */ @@ -1329,7 +1329,7 @@ ReflectClose( static int ReflectInput( - ClientData clientData, + void *clientData, char *buf, int toRead, int *errorCodePtr) @@ -1436,7 +1436,7 @@ ReflectInput( static int ReflectOutput( - ClientData clientData, + void *clientData, const char *buf, int toWrite, int *errorCodePtr) @@ -1565,7 +1565,7 @@ ReflectOutput( static long long ReflectSeekWide( - ClientData clientData, + void *clientData, long long offset, int seekMode, int *errorCodePtr) @@ -1642,7 +1642,7 @@ ReflectSeekWide( #ifndef TCL_NO_DEPRECATED static int ReflectSeek( - ClientData clientData, + void *clientData, long offset, int seekMode, int *errorCodePtr) @@ -1678,7 +1678,7 @@ ReflectSeek( static void ReflectWatch( - ClientData clientData, + void *clientData, int mask) { ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; @@ -1750,7 +1750,7 @@ ReflectWatch( static int ReflectBlock( - ClientData clientData, + void *clientData, int nonblocking) { ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; @@ -1817,7 +1817,7 @@ ReflectBlock( static void ReflectThread( - ClientData clientData, + void *clientData, int action) { ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; @@ -1854,7 +1854,7 @@ ReflectThread( static int ReflectSetOption( - ClientData clientData, /* Channel to query */ + void *clientData, /* Channel to query */ Tcl_Interp *interp, /* Interpreter to leave error messages in */ const char *optionName, /* Name of requested option */ const char *newValue) /* The new value */ @@ -1926,7 +1926,7 @@ ReflectSetOption( static int ReflectGetOption( - ClientData clientData, /* Channel to query */ + void *clientData, /* Channel to query */ Tcl_Interp *interp, /* Interpreter to leave error messages in */ const char *optionName, /* Name of reuqested option */ Tcl_DString *dsPtr) /* String to place the result into */ @@ -2020,7 +2020,7 @@ ReflectGetOption( * result is a valid list. Nor that the list has an even number elements. */ - if (Tcl_ListObjGetElements(interp, resObj, &listc, &listv) != TCL_OK) { + if (TclListObjGetElementsM(interp, resObj, &listc, &listv) != TCL_OK) { goto error; } @@ -2078,7 +2078,7 @@ ReflectGetOption( static int ReflectTruncate( - ClientData clientData, /* Channel to query */ + void *clientData, /* Channel to query */ long long length) /* Length to truncate to. */ { ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; @@ -2090,7 +2090,7 @@ ReflectTruncate( * Are we in the correct thread? */ -#ifdef TCL_THREADS +#if TCL_THREADS if (rcPtr->thread != Tcl_GetCurrentThread()) { ForwardParam p; @@ -2111,7 +2111,7 @@ ReflectTruncate( Tcl_Preserve(rcPtr); - lenObj = Tcl_NewIntObj(length); + lenObj = Tcl_NewWideIntObj(length); Tcl_IncrRefCount(lenObj); if (InvokeTclMethod(rcPtr,METH_TRUNCATE,lenObj,NULL,&resObj)!=TCL_OK) { @@ -2166,7 +2166,7 @@ EncodeEventMask( int evIndex; /* Id of event for an element of the eventspec * list. */ - if (Tcl_ListObjGetElements(interp, obj, &listc, &listv) != TCL_OK) { + if (TclListObjGetElementsM(interp, obj, &listc, &listv) != TCL_OK) { return TCL_ERROR; } @@ -2644,7 +2644,7 @@ MarkDead( static void DeleteReflectedChannelMap( - ClientData clientData, /* The per-interpreter data structure. */ + void *clientData, /* The per-interpreter data structure. */ Tcl_Interp *interp) /* The interpreter being deleted. */ { ReflectedChannelMap *rcmPtr = (ReflectedChannelMap *)clientData; @@ -2766,6 +2766,8 @@ DeleteReflectedChannelMap( MarkDead(rcPtr); Tcl_DeleteHashEntry(hPtr); } +#else + (void)interp; #endif } @@ -2821,7 +2823,7 @@ GetThreadReflectedChannelMap(void) static void DeleteThreadReflectedChannelMap( - TCL_UNUSED(ClientData)) + TCL_UNUSED(void *)) { Tcl_HashSearch hSearch; /* Search variable. */ Tcl_HashEntry *hPtr; /* Search variable. */ @@ -2996,8 +2998,8 @@ ForwardOpToHandlerThread( * Queue the event and poke the other thread's notifier. */ - Tcl_ThreadQueueEvent(dst, (Tcl_Event *) evPtr, TCL_QUEUE_TAIL); - Tcl_ThreadAlert(dst); + Tcl_ThreadQueueEvent(dst, (Tcl_Event *) evPtr, + TCL_QUEUE_TAIL|TCL_QUEUE_ALERT_IF_EMPTY); /* * (*) Block until the handler thread has either processed the transfer or @@ -3329,7 +3331,7 @@ ForwardProc( int listc; Tcl_Obj **listv; - if (Tcl_ListObjGetElements(interp, resObj, &listc, + if (TclListObjGetElementsM(interp, resObj, &listc, &listv) != TCL_OK) { Tcl_DecrRefCount(resObj); resObj = MarshallError(interp); @@ -3359,7 +3361,7 @@ ForwardProc( break; case ForwardedTruncate: { - Tcl_Obj *lenObj = Tcl_NewIntObj(paramPtr->truncate.length); + Tcl_Obj *lenObj = Tcl_NewWideIntObj(paramPtr->truncate.length); Tcl_IncrRefCount(lenObj); Tcl_Preserve(rcPtr); @@ -3407,7 +3409,7 @@ ForwardProc( static void SrcExitProc( - ClientData clientData) + void *clientData) { ForwardingEvent *evPtr = (ForwardingEvent *)clientData; ForwardingResult *resultPtr; |
