C2X, C2D, B2X, B2D, D2C, D2B, D2X, X2C, X2D Each of these is a function taking an argument and possibly a count and returning a conversion of that argument. Each function converts an argument of a type indicated by the first character of the function name (Character, heX, Binary or Decimal) into the type indicated by the last character of the name. Examples: c2x("abc") = "616263" d2x(286)="11E" d2c(65)="A" d2b(65)="01000001" BUG: Each of the conversion functions which deal with decimal numbers is restricted to inputs which have a value of less than 2**31 when converted to an unsigned integer. Details of these functions are below: ......................................................................... B2D(binary) The binary input is converted into a non-negative decimal number. Spaces are allowed in the binary string between four-digit sequences, and the first "four-digit" sequence may contain fewer than four digits, in which case up to three leading '0' digits will be assumed. B2X(binary) Each set of four binary digits in the input is converted to a hex digit and these are concatenated together to form the result. Spaces are allowed in the binary string between four-digit sequences, and the first "four-digit" sequence may contain fewer than four digits, in which case up to three leading '0' digits will be assumed. D2B(decimal) The decimal input is converted into binary. The length of the result is the smallest possible multiple of 8. C2X(string) The n-character string is converted into 2n hex digits. C2D(string[,length]) The string is converted into a decimal number, interpreting the leftmost character as the most significant byte. If length is omitted, then the whole string is converted and the result is positive. If the length is given, then the string is truncated or padded with zero bytes on the left to give a string of this length, and is then taken to be a twos complement number. In this case the result may therefore be negative. D2C(decimal[,length]) The decimal number is converted into a string of characters (with the leftmost character being the most significant). If the length is given, then the result is truncated or sign-extended on the left to be of this length. Otherwise the length of the result is such that the leftmost character is not '00'x (for positive numbers) or 'FF'x (for negative numbers) except in the case of zero, which is converted to '00'x. D2X(decimal[,length]) The decimal number is converted into a hex number. If the length is given, then the result is truncated or sign-extended on the left to be of this length. Otherwise the length of the result is such that for positive numbers there is no leading zero, and for negative numbers there is no leading 'F' except in the case when the next hex digit is less than 8. D2X(0) returns a single zero digit. X2B(hex) Each digit in the given hex string is converted to four binary digits and these are concatenated together. Spaces are optional between pairs of hex digits, and the first "pair" of digits may contain only one digit. X2C(hex) The hex string is converted to characters, just as when 'hex'x is typed. Spaces are optional between pairs of hex digits, and the first byte of the string may optionally contain only one digit, in which case a leading '0' is assumed. X2D(hex[,length]) The hex string, which should contain only hex digits (and no spaces) is first truncated or extended with zeros on the left to be of the given length if necessary, and then converted into a decimal number. If the length is given, then the hex is assumed to be in twos complement notation. Otherwise the result will always be nonnegative. .........................................................................