Command |
Used in a switch-block, specifies a test case and the id of a target list.
public void AppendCaseCallList( int listID, uint cond )
Appends a CASE_CALL_LIST command to the list.
The target list is executed as a sublist. Once, the target list has finished the calling list will resume execution.
The calling list remains busy during the execution of the target list. Once all of the calling list's commands have been processed, it will become idle and as a result trigger a ListIdle event.
For every Execute(Int32) only one ListDone event will be sent along with the list ID of the final main list, i.e. a list that has not been called by any other list(s). Lists that are called by other lists do not produce any ListDone events. However, sub lists do produce ListIdle events.
Please note that this is a contrived example, illustrating very naive usage of the switch-block.
// Arbitrary values for demo only: uint lowSpeedMarkingBitmask = 0x5AA5; uint mediumSpeedMarkingBitmask = 0xA55A; // Arbitrary values for demo only: int lowSpeedMarkingListID = 333; int mediumSpeedMarkingListID = 444; int highSpeedMarkingListID = 555; CommandList listBranch = new CommandList(); listBranch.AppendJumpAbs( 0, 0 ); listBranch.AppendSwitch( IOPort.PortB, true ); listBranch.AppendCaseBranchList( lowSpeedMarkingListID, lowSpeedMarkingBitmask ); listBranch.AppendCaseBranchList( mediumSpeedMarkingListID, mediumSpeedMarkingBitmask ); listBranch.AppendDefaultBranchList( highSpeedMarkingListID ); Console.WriteLine( $"ListBranch commands:" ); int count = 0; foreach ( var cmd in listBranch ) Console.WriteLine( $" {count++}: {cmd.ToString()}" ); CommandList listCall = new CommandList(); listCall.AppendJumpAbs( 0, 0 ); listCall.AppendSwitch( IOPort.PortB, true ); listCall.AppendCaseCallList( lowSpeedMarkingListID, lowSpeedMarkingBitmask ); listCall.AppendCaseCallList( mediumSpeedMarkingListID, mediumSpeedMarkingBitmask ); listCall.AppendDefaultCallList( highSpeedMarkingListID ); Console.WriteLine( $"ListCall commands:" ); count = 0; foreach ( var cmd in listCall ) Console.WriteLine( $" {count++}: {cmd.ToString()}" ); // output should be: // ListBranch commands: // 0: { JA, P2D[ X=0 Y=0 ] } // 1: { SWI, I32[ 1 ], Bool[ True ], U32[ 4294967295 ] } // 2: { CASBL, I32[ 333 ], I32[ 23205 ] } // 3: { CASBL, I32[ 444 ], I32[ 42330 ] } // 4: { DEFBL, I32[ 555 ] } // ListCall commands: // 0: { JA, P2D[ X=0 Y=0 ] } // 1: { SWI, I32[ 1 ], Bool[ True ], U32[ 4294967295 ] } // 2: { CASCL, I32[ 333 ], I32[ 23205 ] } // 3: { CASCL, I32[ 444 ], I32[ 42330 ] } // 4: { DEFCL, I32[ 555 ] }