Click or drag to resize

ListAPIGetListCaret Method

Gets the identified Card-CommandList's current caret position.

Namespace: RAYLASE.SPICE3.ClientLib
Assembly: RAYLASE.SPICE3.ClientLib (in RAYLASE.SPICE3.ClientLib.dll) Version: 3.6.0
Syntax
C#
public int GetListCaret(
	int listID
)

Parameters

listID  Int32
Identifies the Card-CommandList.

Return Value

Int32
The caret position.
Remarks
The caret represents the 0-based offset of the current "end-of-list" position, i.e the position immediately after the last command currently in the list.

It might be found useful for determining target command offsets for flow-control commands such as BRANCH_ABS, etc.

Being 0-based, its value is also, of course, equal to the current count of commands in the list:

List ContentsCaret value
JUMP_ABS 0 0; MARK_ABS 500 500; JUMP_ABS 100 200;3
MARK_BMP_ABS 1000 1000 2000 1000 2 4 6 8 10 12 14 16; JUMP_ABS 0 0;2
Example
C#
using ( ClientAPI client = new ClientAPI() )
{
    client.System.ResetToDefaults();
    client.Connect( cardIP );    // <--- insert your card's IP address here!

    CommandList list = new CommandList();
    list.AppendJumpAbs(0,0);        // offset 0
    list.AppendMarkAbs(500,500);    // offset 1
    list.AppendJumpAbs(100,200);    // offset 2
    // [...append 100 more commands here...]
    client.List.Set(1,list);

    Console.WriteLine("There are {0} commands: {1}",
    client.List.GetListCaret(1),
    client.List.GetListContents(1) );
    // 
    // output should be:
    // There are 103 commands: JA 0 0;MA 500 500;JA 100 200;...
    // 
    client.Disconnect();
}
See Also