Subversion Repositories wimsdev

Rev

Rev 2640 | Go to most recent revision | Details | 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
15
 dd=`bin/ch..root dot -V 2>&1| head -1` ;
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 ;
26
for file in `ls $s2_dir/graphviz/*.$w_graphviz_output`
27
do
28
  num=`basename $file .$w_graphviz_output`
29
  if [ $i -le $num ]; then i=$(( $i+1 )) ; fi
30
done
31
 
32
 
33
# ancien : parm="-T$w_graphviz_output -O -Tplain -Gcharset=$w_graphviz_charset"
34
parm="-T$w_graphviz_output -o $tmp_dir/graphviz.$w_graphviz_output -Tplain -Gcharset=$w_graphviz_charset"
35
parm0="-Tplain -o $tmp_dir/graphviz.plain -Gcharset=$w_graphviz_charset"
36
cat <<@ >$tmp_dir/graphviz
37
$wims_exec_parm
38
@
39
 
40
bin/ch..root $w_graphviz_format $parm $tmp_dir/graphviz > $tmp_dir/graphviz.plain
41
mv -f $tmp_dir/graphviz.$w_graphviz_output $s2_dir/graphviz/$i.$w_graphviz_output
42
 
43
 if [ -f "$s2_dir/graphviz/$i.$w_graphviz_output" ]; then
44
  src="wims.cgi?session=$w_session&+cmd=getins&+special_parm=graphviz/$i.$w_graphviz_output&+modif=$tstamp"
45
 # 
46
 echo "$src"
47
  a=`identify -format \%w,\%h $s2_dir/graphviz/$i.$w_graphviz_output`
48
  echo "$a"
49
  cat $tmp_dir/graphviz.plain
50
 fi
51
#a=identify -format \%w,\%h $s2_dir/$i.$w_graphviz_output
52
 
53
#\text{c=digraph bar {a->b}}
54
#\text{a=wims(exec graphviz  \c)}
55
#\statement{<img src=\"$a\" $w_graphviz_image_attr alt=\"Graphviz traced image\">"}
56
 
57
#<img src=\"$src\" $w_graphviz_image_attr alt=\"Graphviz traced image\">"