; From: Dat Thuc Nguyen
; Newsgroups: comp.protocols.kermit.misc
; Subject: Short-Circuit Macro Execution
; Date: Thu, 25 May 2000 18:12:11 EDT
; URL: http://www.smalltickle.com
; 
; SHORT-CIRCUIT MACRO EXECUTION
;
; The following macros offer the capability to execute a sequence of
; macros with short-circuit effect as in the C language.
;
; Usage Examples:
;
; C-Kermit> define do_this { return 1 }
; C-Kermit> define and_this { return 2 }
; C-Kermit> define and_that { return -1 }
; C-Kermit> define and_this_also { return 3 }
;
; C-Kermit> AND do_this and_this and_that and_this_also
;
; C-Kermit> define or_this { return -1 }
; C-Kermit> define or_that { return -2}
; C-Kermit> define or_that_also { return 3}
;
; C-Kermit> OR  do_this or_this or_that or_that_also

define AND {
    local \%i
    for \%i 1 \v(argc)-1 1 {
        if < \fexecute(\&_[\%i]) 0 break
    }
}

define OR {
    local \%i
    for \%i 1 \v(argc)-1 1 {
        if > \fexecute(\&_[\%i]) 0 break
    }
}

; End
