!--------------------------------------------------------------------
      subroutine trxpl_add_scalar(zname)
 
      implicit NONE
 
      include 'trxpl.blk'
      character*10, intent(in) :: zname   ! name of scalar
 
      ! add a scalar to the list.
 
      !----------------------------
      integer i,ilz,ierr,lnout,idup
      logical lxout
      !----------------------------
 
      ilz=len_trim(zname)
 
      numsc=numsc+1
      sclabs(1,numsc)=zname
      ilz=min(10,ilz+1)
      sclabs(1,numsc)(ilz:ilz)=':'
      sclabs(2,numsc)=zname
 
      idup=numsc
      do i=1,numsc-1
         if(sclabs(1,numsc).eq.sclabs(1,i)) then
            idup=i
         endif
      enddo
 
      if(idup.lt.numsc) then
         write(lnout(0),*) ' %duplicate name: ',zname
         numsc=numsc-1
         ierr=0
      else
         call trx_scal(zname,sclabs(3,numsc),scvals(numsc),ierr)
      endif
 
      if(ierr.ne.0) then
         write(6,*) ' %trxpl:  scalar ',zname(1:ilz),' not added.'
         numsc=numsc-1
      else
         write(6,*) sclabs(1,idup),' ',sclabs(3,idup),
     >      ' = ',scvals(idup)
      endif
 
      return
      end
 
