The Space VLBI Principal Investigator Package has been programmed with a very rudimentary error handling system. This system comprises two stages of error handling. Stage one tries to filter out format errors in the initial input while stage two does elementary range checking on most parameters.
All on screen input requested from the keyboard is put through a routine which screens for unprintable and hidden or special characters. This routine will allow the program to accept only alphanumeric input plus a few special characters. So if the user is requested to enter a number but instead hits a letter then this particular keystroke is ignored. But any numbers subsequently entered will be accepted. A string is built up comprising only the proper inputs and when the ENTER or RETURN key is pressed this string is then converted to a numerical value and passed to the program. If alphanumeric input is expected then the letters [A-Z,a-z,0-9] and [_,+,-] and a few other punctuation characters are accepted. However no other characters will be accepted. This makes entry of strange filenames impossible or at least difficult and makes processing of file commands straightforward.
The same is done with the parameter files radioast.par,vsop.par,restrict.par, ground.par and uvplot.par. Each line is checked for any characters which don't belong and all errors are written to a file called ferrors.txt which details the location and type of error. An example is given below.Date: 17:13:45 Fri May 12, 1995 Error # 1 found in parameter file vsop.par on line 1 Parameter Number 2 Character position 6 Input value is 17878140 0.587f3 31.5073 35.9747 105.3705 0.0 VSOP orbit (a,e,i,RA,peri,M) Unknown character value is f Incorrect type expecting numeric input only. Date: 17:13:45 Fri May 12, 1995 Error # 2 found in parameter file vsop.par on line 4 Parameter Number 4 Character position 1 Input value is -1.0 100.0 120.0 Unknown character value is % Incorrect type expecting numeric input only. As can be seen the programs will scan all the parameter files for any obvious errors such as seen above. The paramater files are scanned out to the 50th column from the left hand side. Anything in column 51 or later is ignored and the space can be used for comments. After the first stage or checking is done the second stage of filtering will take place.
For on screen input the second level of checking is done after the user inputs a parameter and the parameter is checked. If the parameter is found to be inappropriate and out of range then nothing happens and the old parameter is left unchanged. In other cases the parameter is set to some default value and the new input is rejected.
For the parameter files themselves the same thing is done. The parameter files are read in a second time and the values themselves check to see if they fit the range. If not the errors are written to a file called rerrors.txt an example is given below.Date: 17:12:43 Fri May 12, 1995 Error # 1 uvplot.par Color UV parameter not 0 or 1, setting to 0 default. Error # 2 uvplot.par Integration time > delta t setting equal to dt minutes default. As can be seen the date and time are enter as well as including the file in which the error occurs and the type of error encountered. Plus the default value is listed at which the program will use if the user doesn't correct the parameter manually. Sometimes a set of errors will be related to each other which simply means that one set of errors will cause another set. The solution is to fix the appropriate errors which will cause the secondary and sometimes tertiary errors to vanish. The trick is to recognize which errors are the primary ones. That is why the software has been programmed with 2 levels of filtering and error checking. Once the stage 1 errors are fixed then the stage 2 errors remaining are usually not a result of anything found in stage 1.(i.e. stage 1 are format(syntax) errors while stage 2 are range errors.) Of course other types of errors exist such as logic errors of which proper coding usually eliminates.
All errors can't be eliminated, only the most common ones are recognized and intercepted.