The get statement gets raw characters from the specified port.
get var{,length} {setting character.count} from port.exp{until termination.characters} {returning termination.characters} {waiting seconds.exp} {then|else statement.block}
var | Receives the input. Printable characters are echoed to the line, unless the program issues an echo off statement. Control characters are included, but not echoed to the screen. No prompt displays. |
length | Maximum characters to get. If no length is specified, and there is no until clause, 1 is the default. If the length is specified, but this number of characters is not entered, the system waits indefinitely or until the waiting clause times out, the termination.character is entered, or the length is satisfied. If the length is satisfied, the then clause is executed. |
character.count | Number of characters to be returned. If the length expression is less than the number of characters specified by setting, input terminates at the length. If the length expression is greater than setting, only the number of characters specified by the setting are returned to the variable. |
port.exp | Port from which to get characters. This port must have been previously attached with the TCL dev-att command. If an invalid port number is specified or the port is not attached, the else clause is taken. |
termination.characters | Defines a set of characters that terminate input. If the x option is not in effect, the input also terminates on a char(255) (x’ff’). The termination.character is not included in the returned string. When a termination.character is received, the then clause is executed. |
returning | Returns the character that terminated input. If the returning variable is null, and either no length is specified, or the returned data length is less than the length limit, a segment mark (x’ff’) is assumed as the termination.character. |
waiting | Specifies how long, in tenths of a second, the system should wait until an input termination condition exists (such as satisfying the length requirement or the until clause). If a time-out occurs, all input received up to this point is returned in the variable, and the else clause, if present, is executed. |
Data read by the get statement is typically echoed unless the program issues an echo off statement.
Unattached Line
If the line is not previously attached, the get statement will automatically attach and detach the device.
execute \unlink-pibdev 10,10\ execute \dev-att 10\ get xx,80 setting 5 from 10 until (char(13):char(10)) returning term waiting 60 execute \dev-det 10\ execute \link-pibdev 10,10\