PROCEDURE Castwo(VAR asc: PACKED ARRAY [lo..hi: integer] OF char; VAR Bin: Word; VAR pos: integer; radix: integer); EXTERNAL; {*USER* Pascal-3 procedure which converts an input string of ASCII characters in ASC to an unsigned binary word output in BIN using the given radix input in RADIX. POS specifies starting point in ASC on entry, and points to the terminator character or end of ASC (whichever is encountered first) on exit. POS will be return as a negative value if word overflow occurs (exceeds 65535) and so this routine can be used to verify the validity of an input. Leading space, tab and zeros are ignored. Any non-digit following the first encountered digit is treated as a terminator, and of course, the upper limit of the string in ASC will be treated as the terminator. If the number contained in ASC contains a digit that is not valid for the supplied RADIX value, then that digit will be treated as a "non-digit" and thus a terminating character. You can use this behavior to determine if the conversion terminated earlier than expected, and thus implying that the ascii string in ASC is not a valid number. }