programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: Overriding ?ABORT

From: Mike Ghan <mikeghan_at_logix-controls.com>
Date: Tue, 2 Dec 2003 12:41:13 -0800

Try the following.

Mike

REQUIRES DOSBOX

ERROR-HANDLERS +ORDER
WINDOWS-INTERFACE +ORDER

: ABORT-BOX ( addr cnt -- ) \ Display Error Message
   200 MIN ( Sanity )
   R-BUF R@ ZPLACE
   0 ( No HWND ) R> Z" Program Error"
   MB_SYSTEMMODAL MB_ICONERROR OR MB_OK OR MessageBox DROP ;

: SHOW-ERROR ( ior -- ) (THROW) ABORT-BOX ;

' SHOW-ERROR IS .CATCH \ Change vector to SHOW-ERROR

WINDOWS-INTERFACE -ORDER
ERROR-HANDLERS -ORDER

: ALL-DONE ( -- ) \ Proper cleanup
   'ONSYSEXIT CALLS \ Execute System Exit Chain
   0 ExitProcess ;

: GOING ( -- )
   DOS-CONSOLE OPEN-PERSONALITY
   ." The command line contains" CR
   CMDLINE ARGC 0
   ?DO CMDLINE I ARGV TYPE CR
   LOOP
   CR ." Press Enter to Abort, any other key to exit" KEY
   13 = ABORT" Crashed!" ;

: GO ( -- )
   ['] GOING CATCH ?DUP
   IF SHOW-ERROR THEN
   ALL-DONE ;

' GO 'MAIN !

-1 THRESHOLD \ No Xref file

PROGRAM CMDLINE
BYE

-----Original Message-----
From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com]On
Behalf
Of Jeffrey Massung
Sent: Tuesday, December 02, 2003 11:37 AM
To: sftalk_at_forth.com
Subject: [sftalk] Overriding ?ABORT

Is there any way for me to create my own ?ABORT function that can be
used=
 in
place of the current one (even in past use)?

I have a program that is DOS based, and would like to have ?ABORT pop
up =
a
message-box instead out outputting to the console. I can override
ABORT" =
and
?ABORT to work the way I want for future uses, but the interpreter
still =
just
outputs to the console.

I know SF has a built in mechanism for using a messagebox for warning
and=

errors, and this would be decent enough for what I want, but I can't
get =
it to
work outside the SF editor. Any ideas?

Thanks,

Jeff

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Tue Dec 02 2003 - 12:49:13 PST

This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:34 PST