home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ckscripts / shortcircuit < prev    next >
Text File  |  2020-01-01  |  990b  |  42 lines

  1. ; From: Dat Thuc Nguyen
  2. ; Newsgroups: comp.protocols.kermit.misc
  3. ; Subject: Short-Circuit Macro Execution
  4. ; Date: Thu, 25 May 2000 18:12:11 EDT
  5. ; URL: http://www.smalltickle.com
  6. ; SHORT-CIRCUIT MACRO EXECUTION
  7. ;
  8. ; The following macros offer the capability to execute a sequence of
  9. ; macros with short-circuit effect as in the C language.
  10. ;
  11. ; Usage Examples:
  12. ;
  13. ; C-Kermit> define do_this { return 1 }
  14. ; C-Kermit> define and_this { return 2 }
  15. ; C-Kermit> define and_that { return -1 }
  16. ; C-Kermit> define and_this_also { return 3 }
  17. ;
  18. ; C-Kermit> AND do_this and_this and_that and_this_also
  19. ;
  20. ; C-Kermit> define or_this { return -1 }
  21. ; C-Kermit> define or_that { return -2}
  22. ; C-Kermit> define or_that_also { return 3}
  23. ;
  24. ; C-Kermit> OR  do_this or_this or_that or_that_also
  25.  
  26. define AND {
  27.     local \%i
  28.     for \%i 1 \v(argc)-1 1 {
  29.         if < \fexecute(\&_[\%i]) 0 break
  30.     }
  31. }
  32.  
  33. define OR {
  34.     local \%i
  35.     for \%i 1 \v(argc)-1 1 {
  36.         if > \fexecute(\&_[\%i]) 0 break
  37.     }
  38. }
  39.  
  40. ; End
  41.