Subversion Repositories wimsdev

Rev

Rev 3311 | Rev 4301 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1102 bpr 1
#! /bin/sh
2
 
3
#line 1: <img src= address >
4
#line 2: graphviz/number_of_image
5
#line 3: size in pixels width,height
6
#line 4 and following: plain output (for the coordinates)
7
 
8
if [ "$wims_exec_parm" = "" ] || [ "$s2_dir" = "" ] || [ ! -d "$s2_dir" ]; then
9
exit; 
10
fi
11
 
12
tstamp=`date '+%s'`
13
 
14
if [ "$wims_exec_parm" = "about" ]; then
3877 bpr 15
 dd=`./bin/wrap..exec dot -V 2>&1| head -1` ;
1102 bpr 16
 echo "<a href=\"http://www.graphviz.org\">Graphviz</a> ($dd)" ;
17
 exit;
18
fi
19
 
20
if [ -z "$w_graphviz_charset" ]; then w_graphviz_charset="iso-8859-1"; fi
21
if [ -z "$w_graphviz_output" ]; then w_graphviz_output='png' ;  fi
22
if [ -z "$w_graphviz_format" ]; then w_graphviz_format="dot"; fi ;
23
if [ "$w_graphviz_format" != 'dot' -a "$w_graphviz_format" != 'neato'  -a "$w_graphviz_format" != 'circo' -a "$w_graphviz_format" != 'fdp' -a "$w_graphviz_format" != 'twopi' ];  then w_graphviz_format='dot'; fi
24
mkdir -p $s2_dir/graphviz
25
i=1 ;
3311 bpr 26
lsout=`ls $s2_dir/graphviz/*.$w_graphviz_output 2>/dev/null`
27
for file in $lsout
1102 bpr 28
do
29
  num=`basename $file .$w_graphviz_output`
2640 bpr 30
  if [ $i -le $num ]; then i=$(( $num+1 )) ; fi
1102 bpr 31
done
32
 
33
 
34
# ancien : parm="-T$w_graphviz_output -O -Tplain -Gcharset=$w_graphviz_charset"
35
parm="-T$w_graphviz_output -o $tmp_dir/graphviz.$w_graphviz_output -Tplain -Gcharset=$w_graphviz_charset"
36
parm0="-Tplain -o $tmp_dir/graphviz.plain -Gcharset=$w_graphviz_charset"
37
cat <<@ >$tmp_dir/graphviz
38
$wims_exec_parm
39
@
40
 
3877 bpr 41
./bin/wrap..exec $w_graphviz_format $parm $tmp_dir/graphviz > $tmp_dir/graphviz.plain
1102 bpr 42
mv -f $tmp_dir/graphviz.$w_graphviz_output $s2_dir/graphviz/$i.$w_graphviz_output
43
 
44
 if [ -f "$s2_dir/graphviz/$i.$w_graphviz_output" ]; then
45
  src="wims.cgi?session=$w_session&+cmd=getins&+special_parm=graphviz/$i.$w_graphviz_output&+modif=$tstamp"
46
 # 
47
 echo "$src"
48
  a=`identify -format \%w,\%h $s2_dir/graphviz/$i.$w_graphviz_output`
49
  echo "$a"
50
  cat $tmp_dir/graphviz.plain
51
 fi
52
#a=identify -format \%w,\%h $s2_dir/$i.$w_graphviz_output
53
 
54
#\text{c=digraph bar {a->b}}
55
#\text{a=wims(exec graphviz  \c)}
56
#\statement{<img src=\"$a\" $w_graphviz_image_attr alt=\"Graphviz traced image\">"}
57
 
58
#<img src=\"$src\" $w_graphviz_image_attr alt=\"Graphviz traced image\">"