1 " ------------------------------------------------------------
  2 
  3           macro     vfd_mac
  4           maclist   object,save
  5 "
  6 "         Utility macro for generating multi-line vfd's
  7 "
  8           vfd       &F1
  9           maclist   restore
 10 &end
 11 
 12 " ------------------------------------------------------------
 13 
 14 "         assign_by_keyword   Variable,KeywordArgument,MacroName,
 15 "                   (ErrorMessage),
 16 "                   (Keyword,Value),(Keyword,Value), ...
 17 
 18 "
 19 " Internal macro to set arg1 if arg2 matches the keyword in arg3.
 20 "
 21           macro     assign_single_keyword
 22 &^=4,&K&[ ife        FOO,FOO
 23             warn    (assign_by_keyword: A (Keyword,Value) pair must contain exactly two values, not &FQ3.)
 24           ifend_exit
 25 &]
 26           ife       (&2),(&3)
 27             set     &1,&4
 28             macro   assign_by_keyword.error  " Punt the previous contents of this macro
 29 &&end                                   " Since we have successfully assigned.
 30           ifend_exit
 31 &end
 32 
 33 " ------------------------------------------------------------
 34 
 35           macro     assign_by_keyword
 36           maclist   off,save
 37 &>5,&K&[ ife        FOO,FOO
 38             warn    (assign_by_keyword: At least five arguments must be supplied.)
 39             maclist restore
 40           ifend_exit
 41 &]
 42 
 43           macro     assign_by_keyword.error  " Create a macro to complain about errors
 44           warn      (&3: &4)
 45           set       &1,33814345695
 46 &&end
 47 
 48 &R5,&K&( assign_single_keyword  (&1),(&2),&i
 49 &)
 50 
 51           assign_by_keyword.error       " Print error message, if any.
 52 
 53           maclist   restore
 54 &end
 55 
 56 " ------------------------------------------------------------
 57 
 58 "         assign_flags        Variable,(FlagArgument),MacroName,
 59 "                   (ErrorMessage),
 60 "                   (Flag,Value),(Flag,Value), ...
 61 
 62 "
 63 " Internal macro to set arg1 to arg1 + arg2, if arg2 matches the keyword in arg3.
 64 "
 65           macro     assign_single_flag
 66 &^=4,&K&[ ife        FOO,FOO
 67             warn    (assign_flags: A (Flag,Value) pair must contain exactly two values, not &FQ3.)
 68           ifend_exit
 69 &]
 70           ife       (&2),(&3)
 71             bool    &U,&1+&4
 72             set     &1,&U
 73             macro   assign_flags.error " Punt the error message, now that we've assigned successfully
 74 &&end
 75           ifend_exit
 76 &end
 77 
 78 " ------------------------------------------------------------
 79 "
 80 "         Internal macro to iterate over all flag values for a single component of the flags argument
 81 "
 82           macro     iterate_over_flags
 83 
 84           macro     assign_flags.error  " Create a macro to complain about errors
 85           warn      (&2: &3)
 86           set       &1,33814345695
 87 &&end
 88 
 89 &R5,&K&( assign_single_flag  (&1),(&4),&i
 90 &)
 91 
 92           assign_flags.error
 93 
 94 &end
 95 
 96 " ------------------------------------------------------------
 97 
 98           macro     assign_flags
 99           maclist   off,save
100 &>5,&K&[ ife        FOO,FOO
101             warn    (assign_flags: At least five arguments must be supplied.)
102             maclist restore
103           ifend_exit
104 &]
105           set       &1,0                " start out with none
106 
107 &(2       iterate_over_flags  (&1),(&3),(&4),&i,&FQ5
108 &)
109 
110           maclist   restore
111 &end