Program Error;
{$nomain}

{ Version 1.0
  File:[22,310]ERROR.PAS
  Author: Jim Bostwick  6-Oct-83 

  Last Edit: 23-JUN-1988 22:15:12 

  History:
	 23-JUN-1988 21:56:48  - JMB PA3UTL upgrade.

      Philip Hannay.  12-Feb-87.  Commented out call to USRPMA which
        no longer works with PASCAL-2 V2.1E.  Will just exit with
        message and no walkback.

}

%INCLUDE 'PAS$EXT:General.typ';
{%INCLUDE 'PAS$EXT:USRPMA.EXT';}
%INCLUDE 'PAS$EXT:EXITST.EXT';



  Procedure error(number: Integer;
                  class: error_class;
                  msg: packed array [lo..hi: integer] of char;
                  param: integer)
  	;External;

{*USER*

 This is a simple and general error reporting procedure. The contents
of number, msg, and param are up to the caller. When called, a formatted
message is output on the standard output file (OUTPUT), and the pascal
walkback routine is called. If the class is fatal, an exit with status =4
is taken, else return to caller. 

}


Procedure Error;

    Var
      i: integer;


    begin
      if class = fatal_err then
        write('*** FATAL ***')
      else
        write('** WARNING **');
      write(' error #', number:1, ' - ');
      for i := lo to hi do
        write(msg[i]: 1);
      writeln('. param = ' , param:1);
      if class = fatal_err then exitst(4);
    end;
