(* tab p; * * ND-Pascal offers the ability to trap any run-time errors * by writing a special procedure. When transmission is going, * this is strongly desirable, espessially during program development. * The below procedure will write an error-emssage on the debug-file * (if one is defined), and terminate. It may be possible to write * an error-packet in the future also. * *) procedure fault( erno, lino, objad, sinerr : integer ); var Status : integer; begin (* fault *) (* * This test is removed in the official "release". It ensures * that any run-time error is trapped and reported, even if a debug * file has not been connected/defined. I don't think this is a * "clean" way of doing it, but it may be inserted if you so wish. * * if not DbgConnected then begin connect(DbgOut,'DEBUG','KERM','WA',Status); if Status <> 0 then begin connect(DbgOut,'"DEBUG"','KERM','WA',Status); DbgConnected := Status = 0; end else DbgConnected := true; if DbgConnected then rewrite(DbgOut); end; *) if DbgConnected then begin writeln(DbgOut,'PASCAL Run-time error no. ',erno); writeln(DbgOut,'Error occurred at line ', lino); writeln(DbgOut,' at objad ', objad:6:8); if erno in (. 17, (* connect error *) 37 (* I/O Error *) .) then begin writeln(DbgOut,'Sintran error code: ', sinerr ); end; disconnect(DbgOut); end; end; (* fault *)