This web page refers to our older busTRACE 7.0 which is no longer shipping. Click here for details on our latest generation busTRACE software.

busTRACE This WEB page comes from the busTRACE 7.0 User's Manual. (Table of Contents)

Previous Topic Next Topic

The Advanced Link Editor is only intended for our advanced users who have experience with basic 'C' programming; particularly 'C' boolean logic.

Node links allow you to link one script node to another script node. Depending on the results of a script node execution, the node link tells the script where to branch to and continue its execution.

Using our normal node links edit option, you can edit and view the available node links you can use. If you select the Advanced Link Editor option, you are given the option of viewing and editing the actual underlying source code that goes into making a node link.

You can use the toolbar buttons to add, remove, or reposition any of the user defined variables or node links. You can use the Built-in Variables button to view a drop down list of the available system variables and copy them to the clipboard for pasting into your source code.

User Defined Variables

In addition to the system defined variables that you can use, you can also create your own user defined variable. A user defined variable can be used to make your node link equations more readable or to allow subsequent script nodes to have access to that value.

Each user defined variable you add must be of the following format:

$variable_name$ = value

Your variable name must always start and end with '$', followed by the '=' sign, followed by the value you want assigned to the variable. The value can optionally be a boolean equation.

If you have created an execution CDB, you can have access to any data returned from the device and have it stored in a user defined variable. The best way to explain this is by example. Let's say you have an Inquiry CDB sent to a device and you want the returned Peripheral Device Type stored in a $dev_type$ variable. Your equation would be:

Sample equation to store returned peripheral device type in a $dev_type$ variable

$dev_type$ = DATA[0,4,0,0]

We know that the Peripheral Device Type field, of an Inquiry page, is returned in byte #0 bits 4 through 0. In the above sample, we are saying that we want the value of DATA[0,4,0,0] stored in our $dev_type$ variable. The "DATA[]" indicator tells the script to use the data returned from a device during a successful CDB execution. The value contained in the brackets "0,4,0,0" tells us the start byte, start bit, stop byte, stop bit of the data to retrieve.

As another example, let's say we want to create a user defined variable of $is_scsi2_type0 if the returned Inquiry data has a peripheral device of 0 with a version value equal to 2.

Sample equation to store 1 (i.e. TRUE) in $is_scsi2_type0 if device type is 0 and version value is equal to 2

$is_scsi2_type0 = ((DATA[0,4,0,0]==0) && (DATA[2,7,0,0]==2))


Alternatively, if you prefer, you could have the same effect by creating multiple user defined variables:

$dev_type$ = DATA[0,4,0,0]

$version$ = DATA[2,7,0,0]

$is_scsi2_type0 = (($dev_type$==0) && ($version$==2))

Your user defined variables are stored globally and can be accessed in later script nodes. This can help you create complex node links that depend on previous CDB executions or user responses.

Node Links

A node link is a boolean equation that lets the script know whether the script should take that link or not. If the boolean equation evalutes to a non-zero value (i.e. TRUE), then the script will branch to the script node that the link indicates.

The easiest way to learn how to create or edit node links, in the advanced link editor, is to start by adding links through our standard link editor. Once you have added some standard links, you can click on the Advanced Link Editor button to see the underlying boolean equation that is used to create the link.

The boolean equation will likely use some system defined variables and/or your user defined variables. In the above example, we see that Branch on "OK" Selected uses a a boolean equation of #MsgBoxResult#==1. The Branch on "Cancel" Selected links uses a boolean equation of #MsgBoxResult#==2.

You can also specify complex boolean logic. For example, the following can apply to inbound Inquiry data:

((DATA[0,4,0,0]==5) && (DATA[8,7,15,0]=="Memorex")) || (DATA[0,4,0,0]==1)

Since this is returned Inquiry data, we know that DATA[0,4,0,0] is the returned Peripheral Device Type while DATA[8,7,15,0] is the Vendor ID. As a refresher, the Vendor ID data starts at byte offset 8, bit 7, and ends at byte offset 15, bit 0. This link will be used for all CD/DVD devices (i.e. type 5) from Memorex or for all tape drives (i.e. device type 1).

You can use any of the following operators in your boolean equations:



Example: 1+1==2



Example: 1-1==0



Example: 4/2==2



Example: 10%8==2



Example: 4*2==8


Bitwise AND

Example: (23h&0Fh)==03h


Bitwise OR

Example: (23h|0Fh)==2Fh


Logical OR

Example: (01h||00h)==01h


Logical AND

Example: (01h&&00h)==00h



Example: 1+1==2


Not Equal

Example: 1+1!=3


Greater than

Example: (3>3)==0


Greather than or equal to

Example: (3>=3)==1


Less than

Example: (3<3)==0


Less than or equal to

Example: (3<=3)==1

For numerical values, you can enter them in decimal or in hex. If you enter them in hex, you need to prefix the number with 0x (e.g. 0x20) or append the number with 'h' (e.g. 20h). If neither of these conditions are met, the script will treat it as a decimal number.

You can create complex boolean equations using previously set user defined variables, any of the data returned from a drive (using the DATA[] notation), or any of the system defined variables. If the boolean equation evalutes to a non-zero value (i.e. TRUE), the link will be used. If the link is not used, the script will check the next link to see if its boolean equation evaluates to TRUE. If the script has run through all node links with none evaluating to a TRUE condition, this indicates the end of the script and the script will stop running.

See Also: