Click or drag to resize

CommandListAppendCaseCallList(Int32, Int32) Method

Used in a switch-block, specifies a test case and the id of a target list.


Namespace: RAYLASE.SPICE3.ClientLib
Assembly: RAYLASE.SPICE3.ClientLib (in RAYLASE.SPICE3.ClientLib.dll) Version: 3.6.0
Syntax
C#
public void AppendCaseCallList(
	int listID,
	int value
)

Parameters

listID  Int32
The target list identifier.
value  Int32
The value against which the integer variable will be tested. This case will apply if the comparison is an exact match.
Remarks

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.

Example

Please note that this is a contrived example, illustrating very naive usage of the switch-block.

Switch by Variable Value Example
// Arbitrary values for demo only:
string varname = "var";                                 // the name of an integer-variable (on the card) whose value will be tested.

uint lowSpeedMarkingTestValue = 3;                      // a case-value used to test the variable-value.
uint mediumSpeedMarkingTestValue = 6;                   // another case-value used to test the port-value.

// Arbitrary values for demo only:
int lowSpeedMarkingListID = 333;
int mediumSpeedMarkingListID = 444;
int highSpeedMarkingListID = 555;

CommandList listBranch = new CommandList();
listBranch.AppendJumpAbs( 0, 0 );
listBranch.AppendSwitch( varname );
listBranch.AppendCaseBranchList( lowSpeedMarkingListID, lowSpeedMarkingTestValue );
listBranch.AppendCaseBranchList( mediumSpeedMarkingListID, mediumSpeedMarkingTestValue );
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( varname );
listCall.AppendCaseCallList( lowSpeedMarkingListID, lowSpeedMarkingTestValue );
listCall.AppendCaseCallList( mediumSpeedMarkingListID, mediumSpeedMarkingTestValue );
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: { SWIV, I32[ 0 ], U32[ 2317739966 ] }
//  2: { CASBL, I32[ 333 ], I32[ 3 ] }
//  3: { CASBL, I32[ 444 ], I32[ 6 ] }
//  4: { DEFBL, I32[ 555 ] }
// ListCall commands:
//  0: { JA, P2D[ X=0 Y=0 ] }
//  1: { SWIV, I32[ 0 ], U32[ 2317739966 ] }
//  2: { CASCL, I32[ 333 ], I32[ 3 ] }
//  3: { CASCL, I32[ 444 ], I32[ 6 ] }
//  4: { DEFCL, I32[ 555 ] }
See Also