Procedure SCAN( VAR Arg_string : LINE ; count : integer ; VAR status : BYTE ); (*----------------------------------------------*) (* version: 3.1 /8 JUN 80/ by R.E.Penley *) (*----------------------------------------------* ** Scan will scan your input line and return: STATUS: 0 -OK, valid inputs 1 -an attempt was made to exceed "count" characters - so I truncated the string at count chars for you. 2 -an invalid character was detected. You figure out what to do with it! LENGTH(arg string) = 0 means a null string input. ** Valid Alphanumeric chars are the ASCII char set starting at the space [ CHR(32) ] and ending at the tilde [ CHR(126) ]. *----------------------------------------------* GLOBAL StrMax = 255; BYTE = 0..255; LINE = STRING Default; *----------------------------------------------*) VAR loop : (scanning, found, notfound); ix : 1..StrMax; begin { return status = 0 if no errors detected. } status := 0; { return status = 1 if requested length is exceeded } If LENGTH(arg_string) > count then begin status := 1; SETLENGTH(arg_string,count) end; loop := scanning; ix := 1; While (loop=scanning) do { return status = 2 if any invalid chars found } begin If ix > LENGTH(arg_string) then loop := notfound{excellent - no invalid chars} Else If arg_string[ix] IN [' '..'~'] then{good show - keep going} ix := SUCC(ix) Else begin loop := found{invalid char}; status := 2 end end{while} End(*---of SCAN 3.1---*); := SUCC(ix) Else begin loop := found{invalid char}