File: piclo

package info (click to toggle)
mcl 1%3A14-137-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 10,704 kB
  • ctags: 5,125
  • sloc: ansic: 53,217; sh: 4,448; perl: 3,967; makefile: 422
file content (147 lines) | stat: -rwxr-xr-x 2,633 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash -e

# piclo -b abc -e 36 -c falkner.coords -k 0 -l 2 -s 1 -S 20 -X 100 -Y 100 -p llx=90 -p lly=90 -p urx=510 -p ury=510 -o t -p edge=3edge -p rmin=1 -p gmin=1 -p bmin=1 -p rmax=0 -p gmax=0 -p bmax=0 -p boundwidth=0.06 -p edgewidth=0.08

mx=""
fnout=t.ps
coords=""
defopts=""
emax=0
type=ite
scale=15
base=""
X=0
Y=0
k=0
l=5
rot=0
stride=1


while getopts :b:p:e:o:k:s:l:c:m:R:S:X:Y:hd opt
do
    case "$opt" in
    e)
      emax=$OPTARG
      ;;
    d)
      type=dag
      ;;
    b)
      base=$OPTARG
      ;;
    s)
      stride=$OPTARG
      ;;
    m)
      mx=$OPTARG
      ;;
    c)
      coords=$OPTARG
      ;;
    k)
      k=$OPTARG
      ;;
    l)
      l=$OPTARG
      ;;
    p)
      defopts="$defopts -def $OPTARG"
      ;;
    S)
      scale=$OPTARG
      ;;
    R)
      rot=$OPTARG
      ;;
    X)
      X=$OPTARG
      ;;
    Y)
      Y=$OPTARG
      ;;
    o)
      fnout=$OPTARG
      ;;
    h)
      cat <<EOU
-m matrix         file name
-b base           assume ite-$i.$base
-d                assume dag-$i.$base
-c coords         file with PostScript coordinates
-o output         file name
-e num            max #edges
-k num            iterand start
-l num            iterand end
-s num            stride: skip s-1 iterands each time
-p key=val        clm ps PostScript parameters
S num            scale factor
-R num            rotate num degrees
-X num            x translate
-Y num            y translate
EOU
      exit
      ;;
    :) echo "Flag $opt needs argument"
        exit 1;;
    ?) echo "Flag $opt unknown"
        exit 1;;
   esac
done


if test ! "$base" -a ! "$mx"; then
   echo "Need base or matrix! (see -h)"
   exit
fi

if test ! $coords; then
   echo "Need coords! (see -h)"
   exit
fi


OPTIND=$(($OPTIND-1))
shift $OPTIND

j=0


if test "$mx"; then

   clm ps $defopts -imx $mx -o $fnout --header
   cat $coords >> $fnout
   echo "$X $Y translate" >> $fnout
   echo "$scale $scale scale" >> $fnout
   clm ps $defopts -e-max $emax -imx $mx -o - >>$fnout
   echo showpage  >> $fnout
   echo >> $fnout

elif test "$base"; then

   for ((i=$k;i<=$l;i=$i+$stride)); do

      if (($j<10)); then
         jj="0$j"
      else
         jj=$j
      fi
      this=$fnout.$jj.ps
      mx=$type-$i.$base

      clm ps $defopts -imx $mx -o $this --header
      cat $coords >> $this
      echo "$X $Y translate" >> $this
      echo "$scale $scale scale" >> $this
      clm ps $defopts -e-max $emax -imx $mx -caption "foo" -o - >>$this
      echo showpage  >> $this
      echo >> $this
      convert -rotate $rot $fnout.$jj.ps $fnout.$jj.png

      j=$(($j+1))
      echo $j
   done
fi