send Statement

The send statement sends output to a specified port.

Syntax

send str.exp{:} to port.num {then|else statement.block}

Parameter(s)

str.exp

Specifies the output to be sent to the specified port number.

port.num

Port number to which the output is sent.

:

Optionally suppresses a terminating CR/LF.

Description

The port to which the output is being sent must be attached with the TCL dev-att command.

In the send statement, the first expression is evaluated as a string. This string can contain any data formatting expressions that work in the print or crt statements, including cursor positioning, @(column,row), and special functions, @(-n). The actual codes that are generated is determined by the terminal characteristics of the process executing the send, not the port to which the characters are being passed. The correct terminal type must be established with the TCL term command.

port.num must evaluate to a valid port number. If the port number is invalid, and there is no else clause, the program aborts into the FlashBASIC or BASIC debugger. If there is an else clause, it is executed when the port number is invalid.

The send statement is typically used after a port has been attached by the sending process. Attachment ensures that the process has exclusive use of the port. Data can be sent to any port that is linked (but not attached) to another process. If the port is attached to another process, the else clause is executed.

Both the then and else clauses are optional, but, at least one must be specified.

Example(s)

This sends the string, ’begin transmission’, to port 10. If port 10 is already attached by another process, the else clause is executed.

execute "dev-att 10"

send ’begin transmission’ to 10 else print ’port in use’

The string in msg is sent without a CR/LF to the device addressed by device1. If successful, the then clause is executed.

send msg: to device1 then print ’message sent’

This sends the string, "hello there", to port 10 at column position 10 on row 9. The term type of the sender must match with the terminal of the receiver for this to work correctly.

execute "dev-att 10"

string = "hello there"

send @(10,9) : string : to 10 then crt "string sent" else crt "string not sent"

See Also

dev-att Command, dev-det Command, get Statement, in Statement, Statement Blocks, then/else Statement Blocks, ue0ba User Exit