!if $wims_read_parm!=slib_header
 !goto proc
!endif
slib_title=Graphviz
slib_parms=1\
50,
slib_author=Bernadette PERRIN-RIOU
slib_out=the coordinates in pixels of the nodes of a graph\ 
which has been just created by graphviz, one node by line. The first line is \
the size in pixels of the image. On each line, the items from 2 to the end should be\
the text in the nodes (no garanty). 
slib_comment=
slib_example=
 
!exit

:proc
!reset slib_out
slib_parm=$wims_read_parm

!default slib_parm=25
slib_points=$slib_graphviz_out
slib_identify=!line 1 of $slib_points
slib_correct=!line 2 of $slib_points
slib_out=$slib_correct
slib_cnt=!linecnt $slib_points
!for slib_j =3 to $slib_cnt 
 slib_l=!line $slib_j of $slib_points
 !if graph isin $slib_l
   !distribute words $slib_l into slib_b,slib_coeff,slib_xrange,slib_yrange
 !endif
 slib_correct_x=$[$(slib_correct[1])/$slib_xrange]
 slib_correct_y=$[$(slib_correct[2])/$slib_yrange]
 !!!default slib_yrange=$slib_xrange
 !if node isin $slib_l
  !distribute words $slib_l into slib_b,slib_no,slib_x,slib_y,slib_width,slib_height
  slib_text=!words 7 to -5 of $slib_l
  slib_x=$[$slib_correct_x*$slib_coeff*($slib_x-$slib_width/2)]
  slib_y=$[$slib_correct_y*$slib_coeff*($slib_yrange-$slib_y-$slib_height/2)]
  slib_out=!append line $slib_x,$slib_y,$slib_text to $slib_out
  !reset slib_x, slib_y
 !endif
!next

slib_out=$slib_out\
$slib_graphviz_out
