Artifacts Associated With Ticket 6a61b9d614
Ticket change [e62b7d3ca0] (rid 254409) by davygrvy on 2026-06-17 22:06:24:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
Hi, I'm authoring a channel driver extension that requires the use of an interrupt handler at the script layer which needs the use of TCL_EXCEPTION as a watch mask. https://www.tek.com/en/documents/application-note/how-program-instrument-assert-srq-gpib-bus It is distinctly separate from TCL_READABLE See https://github.com/tcltk/tcl/blob/main/generic/tclIO.c#L9255 "exception" is missing from modeOptions and TCL_EXCEPTION is missing from maskArray
- foundin initialized to: "all"
- is_private initialized to: "0"
- login: "davygrvy"
- priority initialized to: "5 Medium"
- private_contact initialized to: "188c82e08dafda0b395d8b1182a0ab03060f986e"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "davygrvy"
- subsystem initialized to: "24. Channel Commands"
- title initialized to:
fileevent command missing "exception" as acceptable watchMask
- type initialized to: "Bug"
Ticket change [f87207bc98] (rid 254410) by davygrvy on 2026-06-17 22:25:36:
- icomment:
I was wondering... Does our sockets channel even support OOB data? If Tcl was to support OOB, I don't think it does, and that it used setsockopt(socket, SO_OOBINLINE...), the sockets channel driver's job *should* be to remove it from the stream and fire an exception event handler, if any And maybe that can be done later
- login: "davygrvy"
- mimetype: "text/plain"
- icomment:
Ticket change [8629a46611] (rid 254438) by davygrvy on 2026-06-18 18:21:37:
- icomment:
Just some more detail about GPIB. It is a different beast compared to a TCP stream and I truly need an exception script to manage the 1980s-era hardware I'm talking with. [The Theory of Serial Polling](https://www.ni.com/en/support/documentation/supplemental/06/serial-polling-and-srq-servicing-with-ni-488-2-software-and-labv.html#section-392030912) ><em>"Because these bit definitions are not consistent among instrument vendors, the method for determining the cause of a service request varies with each device."</em> An example of my use would be the following: ``` # Set up the exception script to manage STB from the incoming # SRQ/RQS alerts on the bus. # fileevent $dmm exception \ [list dmm_stb $dmm [subst -noc {[fconfigure $dmm -pop_stb]}]] # Our exception (STB - status byte) handler script # proc dmm_stb {chan stb} { # Split the STB byte into the informational components as described on # page 3-24 of the Tektronix DM 5010 manual # https://w140.com/tekwiki/images/5/5e/070-2994-01.pdf # binary scan [binary format c $stb] B8 bstr lassign [list [string index $bstr 0] \ [string index $bstr 1] \ [string index $bstr 2] \ [string index $bstr 3] \ [string range $bstr 4 end]] class RQS abnormal busy event # Ignore $RQS as we already know this will be set, as this is where we # came from as an SPOLL response to the SRQ interrupt that has now # been cleared. if {$class} { # DEVICE STATUS # split event bits lassign [list [string index $event 0] \ [string index $event 1] \ [string range $event 2 end]] trigger readable statusCode # alert for a readable condition interrupt happens here if {$readable} { set acv [format %f [string trimright [read $chan] {;}]] puts ">DM5010: ${acv} Vrms" } # fall through -> # $trigger is available, but serves no purpose for us here. # Maybe untrigger now because we got a readable notification, too? set code [expr "0b$statusCode"] ;# [scan] doesn't do this switch -- $code { 0 { #no errors or events } 1 {puts ">DM5010: Below limits device status"} 3 {puts ">DM5010: Above limits device status"} default { puts ">DM5010: Unhandled device status code: $code" } } } else { # EVENT CLASS if {$abnormal} { # ask what error puts $chan {err?} set errCode [string trimright [read $chan] {;}] switch -- $errCode { 101 {set err "Invalid command header"} 102 {set err "Header delimiter error"} 103 {set err "Argument error"} 104 {set err "Argument delimiter error"} 106 {set err "Missing argument"} 107 {set err "Invalid message unit delimiter"} 201 {set err "Not executable in local mode"} 202 {set err "Settings lost due to RTL"} 203 {set err "Input and output buffers full"} 205 {set err "Argument out of range"} 206 {set err "Group Execute Trigger ignored"} 231 {set err "Not in calibrate mode"} 232 {set err "Beyond calibration or null capability"} 301 {set err "Interrupt fault"} 302 {set err "System error"} 303 {set err "Math pack error"} 311 {set err "Converter time-out"} 317 {set err "Front panel time-out"} 318 {set err "Bad ohms calibration constant"} 351 {set err "Calibration checksum error"} default {set err "Unknown instrument error"} } puts ">DM5010: ERROR $errCode: $err" return } # normal events # $busy would indicate the message processor is in a busy # state, at the moment. Why would we care to know? set code [expr "0b$event"] ;# [scan] doesn't do this switch -- $code { 1 {puts ">DM5010: Power-on initialization detected."; dmm_init $chan} 2 {puts ">DM5010: Operation complete."} 3 {puts ">DM5010: You pressed the 'inst id' key."} 6 {puts ">DM5010: Over-range condition detected."} default { puts ">DM5010: Unhandled normal event code: $code" } } } } ``` - login: "davygrvy"
- mimetype: "text/x-markdown"
- username: "davygrvy"
- icomment:
Ticket change [787999127b] (rid 254522) by davygrvy on 2026-06-22 19:15:10:
- icomment:
I've been pondering this change. exception events on, say a TCP socket, could not only include the OOB byte, but could be used to receive QOS changes, and even nameserver lookups. Maybe something like this: ```tcl chan event $sock exception [list socket_except $chan [subst -noc {[chan configure $chan -pop_except_type]}]] proc socket_except {chan type} { switch -- $type { qos { set qos_data [chan configure $chan -pop_qos] } oob { set byte [binary scan c [chan configure $chan -pop_oob]] } } } ``` - login: "davygrvy"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [9a84f7e337] (rid 254749) by davygrvy on 2026-07-05 19:43:22:
- icomment:
From the Tcl_EventProc queued in from the prior Tcl_EventSetupProc of my channel driver's event source, when it calls Tcl_NotifyChannel(..,TCL_EXCEPTION), what happens? Absolutely nothing because [fileevent] is missing the "exception" event type. I create the channel with TCL_EXCEPTION as a valid mask: ```c return Tcl_CreateChannel(&AgpibChannelType, channelName, (ClientData)infoPtr, TCL_EXCEPTION); ``` int mask (in) An OR-ed combination of TCL_READABLE, TCL_WRITABLE and TCL_EXCEPTION that indicates events that have occurred on this channel. - login: "davygrvy"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [baa4531eb3] (rid 254754) by oehhar on 2026-07-06 15:10:24:
- icomment:
I have started a TIP: [https://core.tcl-lang.org/tips/doc/trunk/tip/758.md] I was not able to create the corresponding forum thread. It is probably the following blocked tracker: https://static.cloudflareinsights.com/... Anyway, would be great to continue the development there. David, it would be great, if an eventual implementation branch would start with "tip758-". Thanks for all, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Ticket change [c56d4ad0a5] (rid 254755) by davygrvy on 2026-07-06 16:20:00:
- icomment: "Thanks Harald"
- login: "davygrvy"
- mimetype: "text/plain"
Ticket change [ea4113a7cc] (rid 254765) by oehhar on 2026-07-07 09:30:19:
- closedate changed to: "2461228.8960552663"
- closer changed to: "oehhar"
- icomment:
Thanks, Schelte, for making the forum work [https://fossil-scm.org/forum/forumpost/4443d58677139ce8]. Any discussion should go there now. As information is spread over the core list and in this ticket, it is difficult, but possible. Please allow me to close this ticket and continue in the forum. THanks for all, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Postponed"
- status changed to: "Closed"
- type changed to: "RFE"
- username: "oehhar"