      function CALLFN(c.s)
*
*
*
*
*
*
*
*
*
      common /callfn/ InitFlg
      common /callfn/ PlipStart.fn
      common /callfn/ PlipStop.fn
      common /callfn/ PlipInit.fn
      common /callfn/ PlipTerm.fn
      common /callfn/ PlipCall.fn
      common /callfn/ plip.acct
      common /callfn/ pth
      common /callfn/ exe.pth
      common /callfn/ o.pth
      common /callfn/ off.pth

      $include ccall.bp ccall.common

      $catalog local

      if Initflg and @PATH <> plip.acct then
         s1 = cc$0 : str(cc$nul,256)
         s2 = CC$FN.PUSHOFF : cc$4        : ~
              CC$FN.CALLFN  : PlipTerm.fn : ~
              CC$FN.RTN32   :               ~
              CC$FN.EXIT
         s = ccall(s1,s2)
         res = field(s[5,999],cc$nul,1)
         display 'PlipTerm: res = ' : res

         plip.acct = ''
      end

      if not(InitFlg) then
         dst.dll = @PATH : '\plip_d\qm_' : @USERNO 'r%4' : '.dll'
         cmd = 'copy ' : @PATH : '\plip_d\plipqmd.dll ' : dst.dll
         os.execute cmd
display 'Loading libraries'
         PlipStart.fn = ccall.getfn2(dst.dll,'PlipStart')
         PlipStop.fn  = ccall.getfn2(dst.dll,'PlipStop' )
         PlipInit.fn  = ccall.getfn2(dst.dll,'PlipInit' )
         PlipTerm.fn  = ccall.getfn2(dst.dll,'PlipTerm' )
         PlipCall.fn  = ccall.getfn2(dst.dll,'PlipCall' )

*$*display 'PlipStart.fn = ' : bin2hex(PlipStart.fn)
*$*display 'PlipStop.fn  = ' : bin2hex(PlipStop.fn )
*$*display 'PlipInit.fn  = ' : bin2hex(PlipInit.fn )
*$*display 'PlipTerm.fn  = ' : bin2hex(PlipTerm.fn )
*$*display 'PlipCall.fn  = ' : bin2hex(plipCall.fn )
         InitFlg = 1
      end

      if @PATH <> plip.acct then
         pth = @PATH
         pth = change(pth,':','_')
         pth = change(pth,'\','_')
         exe.pth = @PATH : '\plip_d\plipqms.exe ' : pth
         o.pth  = 5 + len(pth) + 1
         o.pth2 = 5 + len(pth) + 1 + len(exe.pth) + 1
         off.pth = int2bin(o.pth-1,4)

*$*display 'Calling PlipStart'
         s1 = cc$0 : pth : cc$nul : exe.pth : cc$nul : str(cc$nul,256)
         s2 = CC$FN.PUSHOFF : cc$4 : ~
              CC$FN.PUSHOFF : off.pth : ~
              CC$FN.PUSHOFF : int2bin(o.pth2-1,4) : ~
              CC$FN.CALLFN  : PlipStart.fn : ~
              CC$FN.RTN32   : CC$0 : ~
              CC$FN.EXIT
         s = ccall(s1,s2)
*$*display 's = ' : bin2hex(s)
*$*input dummy
         res = field(s[o.pth2,999],cc$nul,1)
*$*display 'PlipStart: res = ' : res

         s1 = cc$0 : pth : cc$nul : str(cc$nul,256)
         s2 = CC$FN.PUSHOFF : cc$4 : ~
              CC$FN.PUSHOFF : off.pth : ~
              CC$FN.CALLFN  : PlipInit.fn : ~
              CC$FN.RTN32   : CC$0 : ~
              CC$FN.EXIT
         s = ccall(s1,s2)
         res = field(s[5+len(pth)+1,999],cc$nul,1)
*$*display 'PlipInit: res = ' : res

         plip.acct = @PATH
      end

*$*display 'c.s [1] = ' : len(c.s) : ' ' : c.s
      s1 = cc$0 : pth : cc$nul : c.s : cc$nul
      s2 = CC$FN.PUSHOFF : cc$4 : ~
           CC$FN.PUSHOFF : off.pth : ~
           CC$FN.CALLFN  : PlipCall.fn : ~
           CC$FN.RTN32   : CC$0 : ~
           CC$FN.EXIT
      s = ccall(s1,s2)
      c.s = s[o.pth,len(c.s)]
*$*display 'c.s [2] = ' : len(c.s) : ' ' : c.s
*
*$*   t = index(c.s,'80E1',1)
*$*   if t then
*$*      c.s = c.s[1,t-1] : 'E943' : c.s[t+4,99999999]
*$*   end

*$*display 'c.s = ' : c.s
*$*stop

      return(c.s)
end
