beautypg.com

Chapter 5: comments, Chapter 5, Comments – Teledyne LeCroy Protocol Analyzers File-Based Decoding User Manual User Manual

Page 23

background image

File-based Decoding User Manual

Chapter 5: Comments

LeCroy Corporation

17

Chapter 5: Comments

Comments may be inserted into scripts as a way of documenting what the script does
and how it does it. Comments are useful as a way to help others understand how a
particular script works. Additionally, comments can be used as an aid in structuring the
program.

Most comments in CSL begin with a hash mark (

#

) and finish at the end of the line. The

end of the line is indicated by pressing the Return or Enter key. Anything contained inside
the comment delimiters is ignored by the compiler. Thus,

# x = 2;

is not considered part of the program. CSL supports only end-of-line comments of this
type (comments that can be used only at the end of a line or on their own line). It's not
possible to place a comment in the middle of a line using the hash mark.

Writing a multi-line comment requires either beginning each line with the hash mark (and
ending that line with a Return or Enter) or using a comment block.

A comment block begins with "/*" and end with "*/". Everything inside of the comment
block is ignored.

Example of a multi-line comment with comment delimiters on each line:

# otherwise the compiler would try to interpret
# anything outside of the delimiters
# as part of the code.

Example of a multi-line comment block:

/*
The compiler ignores all contents
of the block comment.
*/

The most common use of comments is to explain the purpose of the code immediately
following the comment. For example:

# Add a profile if we got a server channel
if(rfChannel != "Failure")
{

result = SDPAddProfileServiceRecord(rfChannel,

"ObjectPush");
}