c
c     Copyright (c) 1999,2000, Compaq Computer Corporation
c
c     See the file "license.terms" for information on usage and redistribution
c     of this file, and for a DISCLAIMER OF ALL WARRANTIES.
c
c     The following are the unified error/informational message routines
c     for terminal and GUI based Postmini...
c
      subroutine pm_clear_error_msg
      implicit none
c
      include 'const.h'
      include 'sysdep.cmn'
      include 'io.cmn'
c
      num_error_msgs = 0
      num_info_msgs = 0
c
      return
      end
c
      integer function pm_num_errors()
      implicit none
c
      include 'const.h'
      include 'sysdep.cmn'
      include 'io.cmn'
c
      pm_num_errors = num_error_msgs
c
      return
      end
c
      integer function pm_num_infos()
      implicit none
c
      include 'const.h'
      include 'sysdep.cmn'
      include 'io.cmn'
c
      pm_num_infos = num_info_msgs
c
      return
      end
c
      integer function pm_put_error_msg(msg)
      implicit none
c
      include 'const.h'
      include 'sysdep.cmn'
      include 'io.cmn'
c
      character*(*) msg
c
c     Locals
      integer ilen, string_len
c
      if( lgui ) then
         if( num_error_msgs .ge. PM_MAX_MSGS) then
            pm_put_error_msg = 1
            return
         endif
         num_error_msgs = num_error_msgs + 1
         msg_error_list(num_error_msgs) = msg
         pm_put_error_msg = 0
      else
c        Else, just write string to terminal
         ilen = string_len(msg)
         write(luttyo,100,err=1000) msg(1:ilen)
100      format(' ',a)
         pm_put_error_msg = 0
      endif
c
      return
c
c     Error condition on write
1000  continue
      pm_put_error_msg = 1
      return
c
      end
c
      integer function pm_get_error_msg(i,msg)
      implicit none
c
      include 'const.h'
      include 'sysdep.cmn'
      include 'io.cmn'
c
      character*(*) msg
      integer i
c
      if( i .lt. 0 .or. i .gt. num_error_msgs ) then
         pm_get_error_msg = 1
         return
      endif
c
      msg = msg_error_list(i)
      pm_get_error_msg = 0
c
      return
      end
c
      integer function pm_put_info_msg(msg)
      implicit none
c
      include 'const.h'
      include 'sysdep.cmn'
      include 'io.cmn'
c
      character*(*) msg
c
c     Locals
      integer ilen, string_len
c
      if( lgui ) then
         if( num_info_msgs .ge. PM_MAX_MSGS) then
            pm_put_info_msg = 1
            return
         endif
         num_info_msgs = num_info_msgs + 1
         msg_info_list(num_info_msgs) = msg
         pm_put_info_msg = 0
      else
c        Else, just write string to terminal
         ilen = string_len(msg)
         write(luttyo,100,err=1000) msg(1:ilen)
100      format(' ',a)
         pm_put_info_msg = 0
      endif
c
      return
c
c     Error condition on write
1000  continue
      pm_put_info_msg = 1
      return
c
      end
c
      integer function pm_get_info_msg(i,msg)
      implicit none
c
      include 'const.h'
      include 'sysdep.cmn'
      include 'io.cmn'
c
      character*(*) msg
      integer i
c
      if( i .lt. 0 .or. i .gt. num_info_msgs ) then
         pm_get_info_msg = 1
         return
      endif
c
      msg = msg_info_list(i)
      pm_get_info_msg = 0
c
      return
      end
