The getx statement receives input from an attached line in ASCII hexadecimal format. The statement returns an exploded ASCII hexadecimal string that allows binary data to contain a decimal 255 (x’ff’)
getx 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. |
If "HELLO" is entered on port 10, xx contains "48454C4C4F". If the string, "HE<Backspace>LLO" is entered, xx contains "4845084C4C4F", where the "08" is the backspace character.
getx xx,10 from 10 waiting 50