Subversion Repositories wimsdev

Rev

Rev 12960 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!if  $wims_read_parm!=slib_header
13594 bpr 2
  !goto proc
20 reyssat 3
!endif
4162 bpr 4
 
4351 bpr 5
slib_author=Georges, Khaznadar
4162 bpr 6
 
20 reyssat 7
slib_example= ,,,,,,,,,0,0,1.2,1.5,2.4,3.2\
2100 georgesk 8
12,8,0,0,1 max t (ms),1 max U (V),blue,red,[255,128,128],0,0,1.2,1.5,2.4,3.2\
9
12,8,0,0,1 max t (ms),1 max U (V),blue,red,[255,128,128],style.grad=x_only, style.dot=o,0,0,1.2,1.5,2.4,3.2
20 reyssat 10
 
11
!exit
12
 
13
:proc
14
 
2100 georgesk 15
!reset slib_formdot,slib_grad,slib_xd, slib_yd, slib_bg, slib_lc, slib_dc, slib_point, slib_xo, slib_yo, slib_xs, slib_ys, slib_labx, slib_laby, slib_maxx, slib_maxy, slib_style, slib_empty, slib_key, slib_val, slib_pos
20 reyssat 16
 
17
slib_parm=!item 1 to 9 of $wims_read_parm
18
!distribute item $slib_parm into slib_xd, slib_yd, slib_xo, slib_yo, slib_xs, slib_ys, slib_bg, slib_lc, slib_dc
19
 
20
slib_point=!item 10 to -1 of $wims_read_parm
21
 
2100 georgesk 22
slib_empty=
23
slib_style=!item 1 of $slib_point
24
slib_pos=!positionof style: in $slib_style
25
!while $slib_pos=0
26
  slib_point=!item 2 to -1 of $slib_point
27
  slib_style= !replace style: by $slib_empty in $slib_style
28
  slib_style= !replace = by , in $slib_style
29
  !distribute item $slib_style into slib_key, slib_val
30
  !if $slib_key=grad
31
    !if $slib_val=no
32
      slib_grad=0
33
    !endif
34
    !if $slib_val=x_only
35
      slib_grad=2
36
    !endif
37
    !if $slib_val=y_only
38
      slib_grad=3
39
    !endif
40
  !endif
41
  !if $slib_key=dot
42
    !if $slib_val=x
43
      slib_formdot=0
44
    !endif
45
    !if $slib_val=o
46
      slib_formdot=2
47
    !endif
48
  !endif
49
  slib_style=!item 1 of $slib_point
50
  slib_pos=!positionof style: in $slib_style
51
!endwhile
52
 
20 reyssat 53
!default slib_xd=8
54
!default slib_yd=8
55
!default slib_xo=1
56
!default slib_yo=1
57
!default slib_xs=1
58
!default slib_ys=1
2100 georgesk 59
!default slib_grad=1
60
!default slib_formdot=1
20 reyssat 61
 
62
slib_labx=!word 2 to -1 of $slib_xs
63
slib_laby=!word 2 to -1 of $slib_ys
64
slib_xs=!word 1 of $slib_xs
65
slib_ys=!word 1 of $slib_ys
66
 
67
slib_maxx=!word 1 of $slib_labx
68
!if $slib_maxx = max
69
  slib_labx = !word 2 to -1 of $slib_labx
70
  !! we need to compute the X step slib_xs, given the values
71
  !! of the total width slib_xd, abscissa of origin slib_xo
72
  !! and knowing that slib_xs currently means a maximum value.
73
  !! slib_xd-slib_xo must be be sufficient to display ticks greater
74
  !! than the current value of slib_xs, the tick step being a multiple
75
  !! of 1, 2 or 5.
76
  slib_log=$[log10($slib_xs/($slib_xd-$slib_xo))]
77
  slib_logint=$[floor($slib_log)]
78
  slib_logmant=$[$slib_log-$slib_logint]
79
  !if $slib_logmant > $[log10(5)]
80
     slib_xs=1e$[$slib_logint+1]
81
  !else
82
    !if $slib_logmant > $[log10(2)]
83
      slib_xs=5e$slib_logint
84
    !else
85
      slib_xs=2e$slib_logint
86
    !endif
87
  !endif
88
!else
89
  slib_maxx=$empty
90
!endif
91
 
92
slib_maxy=!word 1 of $slib_laby
93
!if $slib_maxy = max
94
  slib_laby = !word 2 to -1 of $slib_laby
95
  !! we need to compute the Y step slib_ys, given the values
96
  !! of the total height slib_yd, ordinate of origin slib_yo
97
  !! and knowing that slib_ys currently means a maximum value.
98
  !! slib_yd-slib_yo must be be sufficient to display ticks greater
99
  !! than the current value of slib_ys, the tick step being a multiple
100
  !! of 1, 2 or 5.
101
  slib_log=$[log10($slib_ys/($slib_yd-$slib_yo))]
102
  slib_logint=$[floor($slib_log)]
103
  slib_logmant=$[$slib_log-$slib_logint]
104
  !if $slib_logmant > $[log10(5)]
13594 bpr 105
    slib_ys=1e$[$slib_logint+1]
20 reyssat 106
  !else
107
    !if $slib_logmant > $[log10(2)]
108
      slib_ys=5e$slib_logint
109
    !else
110
      slib_ys=2e$slib_logint
111
    !endif
112
  !endif
113
!else
114
  slib_maxy=$empty
115
!endif
116
 
117
slib_dc=!declosing $slib_dc
118
 
119
slib_point=!declosing $slib_point
120
 
121
slib_bg=!declosing $slib_bg
122
!default slib_bg=240,233,255
123
 
124
slib_lc=!declosing $slib_lc
125
!default slib_lc=255,220,180
126
 
127
slib_dc=!declosing $slib_dc
128
!default slib_dc=10,10,10
129
 
130
!!!!!!!!!!!!!!!!! begin grid !!!!!!!!!!!!!!!!!!!!!!!!!
131
 
12960 bpr 132
slib_grey=white
20 reyssat 133
 
8671 bpr 134
slib_dessin = new $[60*$slib_xd],$[60*$slib_yd]\
135
xrange -0.5, $[10*$slib_xd-0.5]\
136
yrange -0.5, $[10*$slib_yd-0.5]\
20 reyssat 137
fill 1,1,$slib_bg
138
 
139
!! traits fins tous les millimetres
140
slib_dessin=$slib_dessin\
141
linewidth 1\
8671 bpr 142
parallel 0, 0, 0, $[10*$slib_yd], 1, 0, $[10*$slib_xd+1], $slib_lc\
143
parallel 0, 0, $[10*$slib_xd], 0, 0, 1, $[10*$slib_yd+1], $slib_lc
20 reyssat 144
 
145
!! traits gros tous les centimetres
146
slib_dessin=$slib_dessin\
147
linewidth 3\
8671 bpr 148
parallel 0, 0, 0, $[10*$slib_yd], 10, 0, $slib_xd+1, $slib_lc\
149
parallel 0, 0, $[10*$slib_xd], 0, 0, 10, $slib_yd+1, $slib_lc
20 reyssat 150
 
151
!! axe_x
152
slib_dessin=$slib_dessin\
153
linewidth 3\
154
hline 0, $[10*$slib_yo], $slib_grey\
8584 bpr 155
segment $[10*$slib_xd-3],$[10*$slib_yo-1],$[10*$slib_xd-1],$[10*$slib_yo], $slib_grey\
156
segment $[10*$slib_xd-3],$[10*$slib_yo+1],$[10*$slib_xd-1],$[10*$slib_yo], $slib_grey\
20 reyssat 157
parallel 0,$[10*$slib_yo+1],0,$[10*$slib_yo-1], 10, 0, $slib_xd+1, $slib_grey
158
 
159
slib_val=$[-$slib_xo*$slib_xs]
160
slib_dessin=$slib_dessin\
161
linewidth 1
2100 georgesk 162
!if ($slib_grad=2 or $slib_grad=1)
13594 bpr 163
  !for slib_x from 0 to  10*$slib_xd step 10
164
    slib_dessin=$slib_dessin\
165
      text blue,$[$slib_x+1],$[10*$slib_yo-1],medium,$slib_val
166
    slib_val=$[$slib_val+$slib_xs]
167
  !next slib_x
168
  !if $slib_labx != $empty
169
    slib_dessin=$slib_dessin\
170
    text blue,$[$slib_x-20],$[10*$slib_yo-6],medium,$slib_labx
171
  !endif
20 reyssat 172
!endif
173
 
174
!! axe_y
175
slib_dessin=$slib_dessin\
176
linewidth 3\
177
vline $[10*$slib_xo],0, $slib_grey\
8584 bpr 178
segment $[10*$slib_xo-1],$[10*$slib_yd-3],$[10*$slib_xo],$[10*$slib_yd-1], $slib_grey\
179
segment $[10*$slib_xo+1],$[10*$slib_yd-3],$[10*$slib_xo],$[10*$slib_yd-1], $slib_grey\
20 reyssat 180
parallel $[10*$slib_xo+1],0,$[10*$slib_xo-1], 0, 0, 10, $slib_yd+1, $slib_grey
181
 
182
slib_val=$[-$slib_yo*$slib_ys]
183
slib_dessin=$slib_dessin\
184
linewidth 1
2100 georgesk 185
!if ($slib_grad=3 or $slib_grad=1)
13594 bpr 186
  !for slib_y from 0 to  10*$slib_yd step 10
187
    slib_dessin=$slib_dessin\
188
    text blue,$[10*$slib_xo+1],$[$slib_y-1],medium,$slib_val
189
    slib_val=$[$slib_val+$slib_ys]
190
  !next slib_y
191
  !if $slib_laby != $empty
192
    slib_dessin=$slib_dessin\
193
    text blue,$[10*$slib_xo-9],$[$slib_y-10],medium,$slib_laby
194
  !endif
20 reyssat 195
!endif
196
 
197
!!!!!!!!!!!!!!!!! end grid !!!!!!!!!!!!!!!!!!!!!!!!!
198
 
199
slib_i=0
200
!for slib_xy in $slib_point
13594 bpr 201
  !if $slib_i=0
202
    slib_i=1
203
    slib_x=$[10*$slib_xy/$slib_xs]
204
    !goto continue
205
  !endif
206
  !if $slib_i=1
207
    slib_i=0
208
    slib_y=$[10*$slib_xy/$slib_ys]
209
    !if $slib_formdot=0
210
      slib_x1=$[10*$slib_xo+$slib_x-0.6]
211
      slib_x2=$[10*$slib_xo+$slib_x+0.6]
212
      slib_y1=$[10*$slib_yo+$slib_y-0.6]
213
      slib_y2=$[10*$slib_yo+$slib_y+0.6]
214
      slib_dessin=$slib_dessin\
215
      linewidth 2\
216
      segment $slib_x1,$slib_y1,$slib_x2,$slib_y2,$slib_dc\
217
      segment $slib_x2,$slib_y1,$slib_x1,$slib_y2,$slib_dc
218
    !endif
219
    !if $slib_formdot=1
220
      slib_x1=$[10*$slib_xo+$slib_x-1]
221
      slib_x2=$[10*$slib_xo+$slib_x+1]
222
      slib_x3=$[10*$slib_xo+$slib_x]
223
      slib_y1=$[10*$slib_yo+$slib_y]
224
      slib_y2=$[10*$slib_yo+$slib_y+1]
225
      slib_y3=$[10*$slib_yo+$slib_y-1]
226
      slib_dessin=$slib_dessin\
227
      linewidth 2\
228
      segment $slib_x1,$slib_y1,$slib_x2,$slib_y1,$slib_dc\
229
      segment $slib_x3,$slib_y2,$slib_x3,$slib_y3,$slib_dc
230
    !endif
231
    !if $slib_formdot=2
232
      slib_dessin=$slib_dessin\
233
      linewidth 1\
234
      circle $slib_xo+$slib_x,$slib_yo+$slib_y,6,$slib_dc
235
    !endif
236
  !endif
20 reyssat 237
:continue
238
!next slib_xy
239
 
240
slib_out= $slib_dessin