[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
##############################################################################
###+-------+##################################################################
#+-| _QUIT |-----------------------------------------------+##################
#| +-------+ The _QUIT command terminates your program and |##################
#|           returns to DOS without executing the runtime  |##################
#|           call back table or closing open files         |##################
#+---------------------------------------------------------+##################
##############################################################################
##############################################################################
#+--| Syntax |--------------+#################################################
#|     _QUIT <Uint-exp>     |#################################################
#+--------------------------+#################################################
##############################################################################
##############################################################################
########+---| Description |-----------------------------------------+#########
########| _QUIT returns the <Uint-exp> to DOS as an exit code.  The |#########
########| <Uint-exp> can be queried in a batch file using the DOS   |#########
########| ERRORLEVEL command.                                       |#########
########+-----------------------------------------------------------+#########
##############################################################################
##############################################################################
###########+---| Design |-----------------------------------------+###########
###########| When the FORCE runtime code terminates, it calls a   |###########
###########| "call back" procedure that closes all open files,    |###########
###########| etc..  The QUIT command or the ENDPRO keyword        |###########
###########| terminating the force_main procedure, each exit a    |###########
###########| program through the call back.                       |###########
###########| ---------------------------------------------------- |###########
###########| The _QUIT command does NOT go through the call back  |###########
###########| procedure.  It immediately exits to DOS.  Do not use |###########
###########| _QUIT if there are any installed interrupt handlers  |###########
###########| or your program uses the tsr() function.             |###########
###########+------------------------------------------------------+###########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| *    Tell DOS of error and leave without going           |#########
#########| *    through the runtime call back system.               |#########
#########|                                                          |#########
#########| _QUIT 10                                                 |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| *    Return to DOS with an error code that a             |#########
#########| *    batch file can query using ERRORLEVEL.              |#########
#########| *    A batch file could read:                            |#########
#########| *        xyz                                             |#########
#########| *        IF ERRORLEVEL 1 GOTO endbatch                   |#########
#########|                                                          |#########
#########| PROCEDURE return_errorlevel                              |#########
#########|     _QUIT errorlevel[ z ]                                |#########
#########| ENDPRO                                                   |#########
#########|                                                          |#########
#########| PROCEDURE force_main                                     |#########
#########|     ON ERROR DO return_errorlevel                        |#########
#########|     {...}                                                |#########
#########| ENDPRO                                                   |#########
#########+----------------------------------------------------------+#########
##############################################################################

See Also: QUIT
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson