From: MERC::"uunet!WKUVX1.BITNET!MacroMan" 4-NOV-1992 20:46:57.61 To: MACRO32@WKUVX1.BITNET CC: Subj: Re: Undocumented SMG$ locator routine In article <1992Nov4.193916.23882@magnus.acs.ohio-state.edu>, I wrote: > >[...] > > CALL SMG$READ_LOCATOR ( KEYBOARD, ROW, COLUMN, KEYSTROKE ) > >If the user hits a keyboard key instead of a mouse button, the corresponding >terminator code is returned in KEYSTROKE and ROW & COLUMN are set to 0. The >only problem I've discovered is that if the user hits CTRL/Z, the EOF condition >this produces is propagated to the next call to read input (e.g. SMG$READ_- >KEYSTROKE, SMG$READ_COMPOSED_LINE, etc.). I worked around this by special- >casing CTRL/Z and calling SMG$READ_KEYSTROKE to "eat" the EOF condition. >(SMG$CANCEL_INPUT was not sufficient.) > >[...] It's not that easy. I discovered that on a DECterm, the extra call to SMG$READ_KEYSTROKE works just fine. On a standard text terminal (e.g. VT102), the SMG$READ_KEYSTROKE should NOT be executed; on such terminals, SMG$READ_- LOCATOR does not leave the CTRL/Z "waiting". Until SMG$READ_LOCATOR is docu- mented and/or fixed, I'm using the following (FORTRAN) code: LOGICAL MOUSE/ .TRUE./ EXTERNAL SMG$_EOF SAVE MOUSE ... IF ( MOUSE ) THEN CALL SMG$READ_LOCATOR (keyboard-id, row, column, KEYCODE) ELSE CALL SMG$READ_KEYSTROKE (..., KEYCODE, ...) ENDIF IF ( KEYCODE .EQ. SMG$K_TRM_CTRLZ .AND. MOUSE ) THEN STATUS = SMG$READ_KEYSTROKE ( ...,KEYCODE, , 1, ...) IF ( .NOT. STATUS ) THEN MOUSE = STATUS .EQ. %LOC ( SMG$_EOF ) ELSE MOUSE = .FALSE. ENDIF ENDIF ... The jist of this code is that the first time through, it assumes a mouse is connected. If the user hits CTRL/Z in response to the call to SMG$READ_- LOCATOR, SMG$READ_KEYSTROKE is called with a time-out value of 1 (second?). If the call times out or returns anything other than an end-of-file condition, it asumes the user is on a terminal not equipped with a mouse; otherwise (SMG$- READ_KEYSTROKE picked up an EOF w/o timing out), it continues believing it's on a mouse-equipped terminal. Since we don't have any real VT300-series terminals, I can't test this code out on those platforms; if anyone feels so inclined, I wouldn't mind hearing what happens when the above code is run on a real VT3{3|4}0. Also, just a reminder that we're running under 5.5-1. If anyone out there running 5.5-2 in field test could speak to whether the SMG$READ_LOCATOR call is documented and/or fixed, I'd appreciate it. Thanks, Mike -- Internet: davism@KCGL1.eng.ohio-state.edu | -or- DAVISM+@osu.edu | These Thoughts, They Be Mine BITNET: DAVISM+@OHSTMAIL.BITNET |