Macro: CASE

Module location: Case.mac line 13 (view source)

Case {Begin|Break|Else|End}

  #IFSAME !1 BEGIN                      // ---CASE BEGIN---
    #IFIND           // this handles flex bug/feature that              
      [] Begin       // single commands in macros lose their indicators. 
    #ELSE            // If an indicator force them to be kept           
      Begin
    #ENDIF
    Case$Begin$!r:
  #ELSE
    #POP S$
    #PUSH !s
    #IFSAME !1 BREAK                    // ---CASE BREAK---
      Case$Break !1 !2
    #ELSE  
      #CHECK Case$Begin$!s _RSNDIE#OBU
      #IFSAME !1 END                    // ---CASE END---
        #CHECK Case$If$!s _RSNDIE#OBU
        #SET N$ !n-1
        #IFDEF Case$Else$!s
        #ELSE
          #XPOP !n S$     // Get goto line number from last IF.
          #FREF (!a+1) !s // Modify goto line number as next command
        #ENDIF
        End
      #ELSE
        #CHECK Case$Else$!s _T
        #IFSAME !1 ELSE                 // ---CASE ELSE---
          #CHECK Case$If$!s _RSNDIE#OBU
          Case$Else$!s:
          #SET N$ !n-1
          #IF (!0>1)
            !1 !2 !3 !4 !5 !6 !7 !8  !9
          #ELSE  
            #XPOP !n S$       //--- else w/ 0 args
            #FREF (!a+1) !s
          #ENDIF  
          #SET N$ !N
        #ELSE                           // ---CASE <test>---
          #IFDEF Case$If$!s
            #SET N$ !n-1
            Else If !1 !2 !3 !4 !5 !6 !7 !8  !9
            #SET N$ !N
          #ELSE
            Case$If$!s:
            If !1 !2 !3 !4 !5 !6 !7 !8  !9
            #SET N$ !N
            #XPUSH !n $INIT  // Init IF/ELSE stack at this nesting level.
          #ENDIF
        #ENDIF
      #ENDIF
    #ENDIF  
  #ENDIF