!if $parms=$empty
 !exit
!endif

!distribute items $parms into sx,sy
!set ppm=!item 3 to -1 of $parms
!set ppm=!replace internal \filedir/ by $ in $ppm
!for pm in ppm, sx, sy
  !set pp=$($pm)
  !set pp=!replace internal \\ by ///?/?/?/// in $pp
  !set pp=!replace internal \ by $$m_ in $pp
  !set pp=!replace internal ///?/?/?/// by \\ in $pp
  !set $pm=$pp
!next pp
!set ppm=!replace internal $	$ by $\
$ in $ppm
!set pp=$ppm

!set a=!word 1 of $pp
!if $a=animate
  !set a=!line 1 of $pp
  !set a=!word 2 to -1 of $a
  !set pp=!line 2 to -1 of $pp
  !set ins_anim_frames=!item 1 of $a
  !set ins_anim_delay =!item 2 of $a
  !set ins_anim_loop  =!item 3 of $a
!endif

!set insdraw_filebase=$docdir/$doc/files
!set insdraw_size=$sx,$sy
!set ins_align=middle
!insdraw $pp
