Module Case.mac
1//*************************************************************************
2//
3// Copyright (c) 1995 Data Access Corporation, Miami Florida,
4// All rights reserved.
5// DataFlex is a registered trademark of Data Access Corporation.
6//
7//*************************************************************************
8
9// CASE.MAC
10// version: 2.02e
11// Author John J. Tuohy
12
13#COMMAND CASE R // Case {Begin|Break|Else|End}
14 #IFSAME !1 BEGIN // ---CASE BEGIN---
15 #IFIND // this handles flex bug/feature that
16 [] Begin // single commands in macros lose their indicators.
17 #ELSE // If an indicator force them to be kept
18 Begin
19 #ENDIF
20 Case$Begin$!r:
21 #ELSE
22 #POP S$
23 #PUSH !s
24 #IFSAME !1 BREAK // ---CASE BREAK---
25 Case$Break !1 !2
26 #ELSE
27 #CHECK Case$Begin$!s _RSNDIE#OBU
28 #IFSAME !1 END // ---CASE END---
29 #CHECK Case$If$!s _RSNDIE#OBU
30 #SET N$ !n-1
31 #IFDEF Case$Else$!s
32 #ELSE
33 #XPOP !n S$ // Get goto line number from last IF.
34 #FREF (!a+1) !s // Modify goto line number as next command
35 #ENDIF
36 End
37 #ELSE
38 #CHECK Case$Else$!s _T
39 #IFSAME !1 ELSE // ---CASE ELSE---
40 #CHECK Case$If$!s _RSNDIE#OBU
41 Case$Else$!s:
42 #SET N$ !n-1
43 #IF (!0>1)
44 !1 !2 !3 !4 !5 !6 !7 !8 !9
45 #ELSE
46 #XPOP !n S$ //--- else w/ 0 args
47 #FREF (!a+1) !s
48 #ENDIF
49 #SET N$ !N
50 #ELSE // ---CASE <test>---
51 #IFDEF Case$If$!s
52 #SET N$ !n-1
53 Else If !1 !2 !3 !4 !5 !6 !7 !8 !9
54 #SET N$ !N
55 #ELSE
56 Case$If$!s:
57 If !1 !2 !3 !4 !5 !6 !7 !8 !9
58 #SET N$ !N
59 #XPUSH !n $INIT // Init IF/ELSE stack at this nesting level.
60 #ENDIF
61 #ENDIF
62 #ENDIF
63 #ENDIF
64 #ENDIF
65#ENDCOMMAND
66
67#COMMAND CASE$BREAK R """BEGIN""END" // internal. used by CASE
68 #IF (!s=0) // Mon 04-23-1990
69 #CHECK "CASE BREAK" ""
70 #ELSE
71 #IFDEF Case$Begin$!s
72 #IFSAME !2 BEGIN
73 Goto Begin$!s
74 #ELSE
75 Goto End$!s
76 #ENDIF
77 #ELSE
78 #SET S$ (!s-1)
79 Case$Break !1 !2
80 #ENDIF
81 #ENDIF
82#ENDCOMMAND
83