Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Artful Two for Clipper 5.0 - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

Syntax

AMACHINE( aArray [, nFlag ] )

Purpose

A general-purpose state machine which performs in one of two modes,
incremental and sudden-death. In incremental mode the machine
advances stepwise toward completion, retreating with each cancellation
(ESC). In sudden-death mode, the machine terminates on the first
cancellation.

Arguments

     aArray -- of udfs to execute
     nFlag -- 1 = increment, 2 = sudden death

Setup

Fill aArray[] with udfs, and declare them all EXTERNAL.

Example

Execute a state machine in either mode, depending upon user input:


     PRIVATE i, n, msg
     msg = "This is state "
     declare udfs[ 5 ]          && Fill array with udfs

     FOR i = 1 TO 5
         udfs[ i ] = 'POP_MSG( msg + STRINT(i) )'
     NEXT

     DO WHILE .T.
         n = ASK_FOR( "Machine mode to use", n, "9" )
         IF EMPTY( n ) .OR. LASTKEY() = 27
             EXIT
         ENDIF
         AMACHINE( udfs, n )
     ENDDO

     SET CURSOR ON
     RETURN

Returns

.T. on completion, else .F.

Side Effects

Of the udfs called in aArray[].

Artful Calls

None.

Source File

AA_AMCHN.PRG

See Also: L_MENU() V_MENU()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson