156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
* Declarations for functions used only in this file.
*/
static int SerialBlockProc(ClientData instanceData, int mode);
static void SerialCheckProc(ClientData clientData, int flags);
static int SerialCloseProc(ClientData instanceData,
Tcl_Interp *interp);
static int SerialEventProc(Tcl_Event *evPtr, int flags);
static void SerialExitHandler(ClientData clientData);
static int SerialGetHandleProc(ClientData instanceData,
int direction, ClientData *handlePtr);
static ThreadSpecificData *SerialInit(void);
static int SerialInputProc(ClientData instanceData, char *buf,
int toRead, int *errorCode);
|
>
>
|
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
* Declarations for functions used only in this file.
*/
static int SerialBlockProc(ClientData instanceData, int mode);
static void SerialCheckProc(ClientData clientData, int flags);
static int SerialCloseProc(ClientData instanceData,
Tcl_Interp *interp);
static int SerialClose2Proc(ClientData instanceData,
Tcl_Interp *interp, int flags);
static int SerialEventProc(Tcl_Event *evPtr, int flags);
static void SerialExitHandler(ClientData clientData);
static int SerialGetHandleProc(ClientData instanceData,
int direction, ClientData *handlePtr);
static ThreadSpecificData *SerialInit(void);
static int SerialInputProc(ClientData instanceData, char *buf,
int toRead, int *errorCode);
|
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
SerialInputProc, /* Input proc. */
SerialOutputProc, /* Output proc. */
NULL, /* Seek proc. */
SerialSetOptionProc, /* Set option proc. */
SerialGetOptionProc, /* Get option proc. */
SerialWatchProc, /* Set up notifier to watch the channel. */
SerialGetHandleProc, /* Get an OS handle from channel. */
NULL, /* close2proc. */
SerialBlockProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
NULL, /* wide seek proc */
SerialThreadActionProc, /* thread action proc */
NULL /* truncate */
};
|
|
|
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
SerialInputProc, /* Input proc. */
SerialOutputProc, /* Output proc. */
NULL, /* Seek proc. */
SerialSetOptionProc, /* Set option proc. */
SerialGetOptionProc, /* Get option proc. */
SerialWatchProc, /* Set up notifier to watch the channel. */
SerialGetHandleProc, /* Get an OS handle from channel. */
SerialClose2Proc, /* close2proc. */
SerialBlockProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
NULL, /* wide seek proc */
SerialThreadActionProc, /* thread action proc */
NULL /* truncate */
};
|
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
|
}
return errorCode;
}
/*
*----------------------------------------------------------------------
*
* SerialCloseProc --
*
* Closes a serial based IO channel.
*
* Results:
* 0 on success, errno otherwise.
*
* Side effects:
|
|
|
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
|
}
return errorCode;
}
/*
*----------------------------------------------------------------------
*
* SerialCloseProc/SerialClose2Proc --
*
* Closes a serial based IO channel.
*
* Results:
* 0 on success, errno otherwise.
*
* Side effects:
|
660
661
662
663
664
665
666
667
668
669
670
671
672
673
|
ckfree(serialPtr);
if (errorCode == 0) {
return result;
}
return errorCode;
}
/*
*----------------------------------------------------------------------
*
* SerialBlockingRead --
*
* Perform a blocking read into the buffer given. Returns count of how
|
>
>
>
>
>
>
>
>
>
>
>
>
|
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
|
ckfree(serialPtr);
if (errorCode == 0) {
return result;
}
return errorCode;
}
static int
SerialClose2Proc(
ClientData instanceData, /* Pointer to SerialInfo structure. */
Tcl_Interp *interp, /* For error reporting. */
int flags)
{
if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) {
return SerialCloseProc(instanceData, interp);
}
return EINVAL;
}
/*
*----------------------------------------------------------------------
*
* SerialBlockingRead --
*
* Perform a blocking read into the buffer given. Returns count of how
|