Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: bjorn_lindstrom@mac2.net.com,Heartagold@aol.com (Bjorn Lindstrom)
Subject: Trapping Control-Y/F6 in Basic
Date: Tue, 28 Mar 1995 16:52:17 -0800	[thread overview]
Message-ID: <bjorn_lindstrom-2803951652170001@mac_apps5.net.com> (raw)

I hope someone can point me in the right direction ...

I am trying to prevent users from interrupting their current session, and
am having trouble with the code found in Programming Volume 5C, on pages
SMG-359 and SMG-360.  There were some typos in the manual, which I have
found, and fixed.  

My problem is that when I try to run this, and type a control-Y (or a F6),
the program blows up with the message:

Following is a sample of my code, which occurs after opening my files, and
declaring my FMS screens.  No screen has been displayed yet, BTW.
------------------ Begin Included Text ---------------------
%INCLUDE "$SMGDEF"      %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET"
%INCLUDE "$SSDEF"       %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET"
%INCLUDE "LIB$ROUTINES" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET"

! (They conveniently left out the following lines the manual ... grrr

EXTERNAL LONG FUNCTION SMG$CREATE_PASTEBOARD( LONG )
EXTERNAL LONG FUNCTION SMG$CREATE_VIRTUAL_KEYBOARD( LONG )
EXTERNAL LONG FUNCTION SMG$SET_OUT_OF_BAND_ASTS(LONG, LONG, LONG, LONG)

! The following code is almost verbatim from the manual ...

DECLARE LONG STAT, PASTEBOARD_ID, KEYBOARD_ID, CONTROL_MASK

CONTROL_MASK = (2 ** SMG$K_TRM_CTRLC)  &
               + (2 ** SMG$K_TRM_CTRLY)

STAT = SMG$CREATE_PASTEBOARD( PASTEBOARD_ID )
GOTO 32000 IF STAT <> SS$_NORMAL

STAT = SMG$CREATE_VIRTUAL_KEYBOARD( KEYBOARD_ID )
GOTO 32000 IF STAT <> SS$_NORMAL

STAT = SMG$SET_OUT_OF_BAND_ASTS( PASTEBOARD_ID,  &
                                 CONTROL_MASK,   &
                                 LOC( DISABLE_CTLC_CTLY ),  &
                                 KEYBOARD_ID)
GOTO 32000 IF STAT <> SS$_NORMAL
----------------------- End of Included Text ----------------------

Everything is working fine at this point.  I display my (already loaded
FMS screen, and prompt for user input, through a field.  When I press
Control-Y, nothing happens.  So far, so good, thinks I.  So, I enter a
valid response to the field, and when I "accept" the value, *whammo*, I
see the following messages:

"Reserved operand fault at PC=0097A188, PSL=03C0000C"

and ...

"break on unhandled exception at SHARE$SMGSHR+103816"

The subprogram it is calling is as follows (BTW, the SMG$ reference is
incorrect in the manual):
------------------------- Begin Included Text --------------------
SUB DISABLE_CTLC_CTLY( SMG$R_OUT_OF_BAND_TABLE SMG_INFO,  &
                       LONG R0, LONG R1, LONG PC, LONG PSL )

%INCLUDE "$SMGDEF"      %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET"
%INCLUDE "$SSDEF"       %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET"
%INCLUDE "LIB$ROUTINES" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET"

IF SMG_INFO::SMG$B_CHAR = SMG$K_TRM_CTRLY       &
OR SMG_INFO::SMG$B_CHAR = SMG$K_TRM_CTRLC THEN
       PRINT CHR$(7);  !* BEEP TERMINAL
ELSE
       !*      IGNORE
END IF

SUBEND
------------------------- End of Included Text -----------------------

Should I be setting up for the ASTS *BEFORE* setting up FMS?  If not, what
am I doing wrong here?

Thanks in advance for any and all help offered!

Bjorn
Lead Guitarist, YAF Band
Proud owner of:
'94 Custom Built B.C. Rich Mockingbird (Zebrawood/Graphite)


                 reply	other threads:[~1995-03-29  0:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox