LOOPIF <test> [NEWLISTX=<list-name>] [NEWLISTY=<list-name>] <statements1>
[LOOPFAIL <statements2>]
where <test> is one of the following:
<word-param-list> VALID
[<$-word>=] <group-param-list> VALID
<list-expr> EQ|NE|GE|LE|GT|LT <sortword>|(<expression>)
<list-expr> PASSES|FAILS <1D-gate>
<list-expr> MASKEDBY <16-bit mask>
<list-expr> GATEDBY <1D-gate-expr>
<list-exprx> <list-expry> GATEDBY <2D-gate-expr>
<list-exprx> <sortwordy>|(<expressiony>) GATEDBY <2D-gate-expr>
<sortwordx>|(<expressionx>) <list-expry> GATEDBY <2D-gate-expr>
and <list-expr> is either a word- or a group- parameter list:
<word-parameter-list-name>
[<$-word>=] <group-parameter-list-name>.<item-name>
where for a group parameter list the particular group passed may be stored in the group variable $-word if specified. <gate-expr> is one of:
<gate-map-name>
<arraylist-of-gate-maps>[<expression>]
where the gate dimension must match the number of arguments tested. The <expression> specified with the arraylist argument determines the offset into the arraylist, starting from zero, and hence the particular gate map referenced.
The LOOPIF command is a parameter-list form of the IF command, ie. it executes an IF test for all words in an input parameter-list. Each time an item from the list (or item pair from the lists) is found that satisfies the test <statements1> are executed.
If the input list is a word parameter list then for each test the current parameter value being tested is placed in the reserved variable WORDX (WORDY for <parameter-list-name>y).
For the LOOPIF...MASKEDBY <bitmask-set-name> and LOOPIF...GATEDBY commands, the gate number passed each time is placed in the reserved variable GATE.
If the NEWLISTX and/or NEWLISTY5 keywords are used to specify output parameter lists then for each parameter which satisifes the test all the other parameters in the input list are copied to the specified output lists.
If no parameter-list items satisfy the test and LOOPFAIL has been specified then <statements2> are executed.
Eg. consider the case where 2 group parameter lists are being tested together against a 2D gate-map. Each valid word in the first list is tested with all valid words in the second list:
ie. all the combinations of E2 words in lists LIST1 and LIST2 will be tested. For those combinations which pass any of the gates in the gate-map GATES1 then the INC command will cause all permutations of the remaining E2 words in the lists (LIST1A and LIST2A) to be incremented into the 2D spectrum MAT6.CREATELIST LIST1 GE30 CREATELIST LIST2 GE150 LOOPIF LIST1.E2 LIST2.E2 GATEDBY GATES1 NEWLISTX=LIST1A NEWLISTY=LIST2A INC MAT6(LIST1A.E2,LIST2A.E2)