Chapter 9: context, 9 context, Hapter – Teledyne LeCroy Merlins Wand - CSL manual (CATC Scripting Language Manual) User Manual

Page 33: Ontext

Advertising
background image

27

CATC Scripting Language for Bluetooth Analyzers

CATC

Manual Ver. 1.21

C

HAPTER

9: C

ONTEXT

The context is the mechanism by which transaction data is passed in and out of the
scripts. There is an output context that is modified by the script, and there are
possibly multiple input contexts that the script will be invoked on separately.

A context serves two roles: firstly, it functions as a symbol table whose values are
local to a particular transaction; secondly, it functions as an interface to the appli-
cation. Two keywords are used to reference symbols in the context:

in

and

out

. Dot

notation is used to specify a symbol within a context:

out.symbol = "abcd";

out.type = in.type;

The output context can be read and written to, but the input context can only be read.
Context symbols follow the same rules as local variables: they are created on
demand, and uninitialized symbols always evaluate to null.

When a script is first invoked, it is given an input context that corresponds to a
packet or transaction that is a candidate for being a part of a larger transaction. The
output context is initially empty. It is the script's job to examine the input context
and decide if it qualifies for membership in the type of transaction that the script
was designed to decode. If it qualifies, the appropriate values will be decoded and
put in the output context symbol table, and if the transaction is complete, it will be
done. If the transaction is not complete, the script will indicate this to the applica-
tion based on its return value, and will be invoked again with the same output
context, but a new input context. The script then must decide if this new input
context is a member of the transaction, and keep doing this until the transaction is
complete.

In order to accomplish all this, state information should be placed in the output
context. It should be possible to use the output context of one transaction as an
input context to another transaction.

Advertising