File: balance

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (242 lines) | stat: -rw-r--r-- 7,998 bytes parent folder | download | duplicates (3)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
!if $wims_read_parm!=slib_header
  !goto proc
!endif

slib_author=Paul, Byache; Bernadette, Perrin-Riou

slib_example=[1000,200,50,A],[B],,,html\
[1000,200,50,A],[B],,,html canvasdraw\
[1000,200,50,A],[B]\
[1000,200,50,A],[B],,,url\
[1000,200,50,A],[B],6,yellow,html one\
[1000,200,50,A],[B],-6,,html

!exit

:proc
!reset slib_left slib_right slib_left1 slib_right1 slib_objet_left slib_objet_right slib_option

!distribute items $wims_read_parm into slib_left1,slib_right1,slib_penche,slib_color,slib_option
slib_left1=!declosing $slib_left1
slib_right1=!declosing $slib_right1

!for slib_u in $slib_left1
    !if $slib_u iswordof 1000 500 200 100 50 20 10 5 2 1
      slib_left = !append item $slib_u to $slib_left
    !else
      slib_objet_left=!append item $slib_u to $slib_objet_left
    !endif
!next
!for slib_u in $slib_right1
    !if $slib_u iswordof 1000 500 200 100 50 20 10 5 2 1
      slib_right = !append item $slib_u to $slib_right
    !else
      slib_objet_right=!append item $slib_u to $slib_objet_right
    !endif
!next
slib_color=!append item $slib_color to $slib_color
slib_color=!nonempty items $slib_color
!default slib_color=!shuffle orange,purple,red,yellow
negatif -> right plus bas
!!slib_penche=-7
!default slib_penche=0
slib_agr=1.8
slib_par=!randint -20,20
slib_width1000=12
slib_height1000=35
slib_poids1000=frectangle 0,0,$(slib_width1000),$(slib_height1000),white\
frectangle 0,0,$(slib_width1000),$(slib_height1000),lightgrey\
rectangle 0,0,$(slib_width1000),$(slib_height1000),black\
fcircle $[$(slib_width1000)/2],$[$slib_height1000+2],15,black\
text black,2,28,medium,1kg

slib_width500=11
slib_height500=25
slib_poids500=frectangle 0,0,$(slib_width500),$(slib_height500),white\
frectangle 0,0,$(slib_width500),$(slib_height500),lightgrey\
rectangle 0,0,$(slib_width500),$(slib_height500),black\
fcircle $[$(slib_width500)/2],$[$slib_height500+2],15,black\
text black,1,18,medium,500g

slib_width200=10
slib_height200=20
slib_poids200=frectangle 0,0,$(slib_width200),$(slib_height200),white\
frectangle 0,0,$(slib_width200),$(slib_height200),lightgrey\
rectangle 0,0,$(slib_width200),$(slib_height200),black\
fcircle $[$(slib_width200)/2],$[$slib_height200+2],15,black\
text black,1,14,medium,200g

slib_width100=9
slib_height100=15
slib_poids100=frectangle 0,0,$(slib_width100),$(slib_height100),white\
frectangle 0,0,$(slib_width100),$(slib_height100),lightgrey\
rectangle 0,0,$(slib_width100),$(slib_height100),black\
fcircle $[$(slib_width100)/2],$[$slib_height100+1],10,black\
text black,1,9,medium,100g

slib_width50=8
slib_height50=12
slib_poids50=frectangle 0,0,$(slib_width50),$(slib_height50),white\
frectangle 0,0,$(slib_width50),$(slib_height50),lightgrey\
rectangle 0,0,$(slib_width50),$(slib_height50),black\
fcircle $[$(slib_width50)/2],$[$slib_height50+1],10,black\
text black,1,$[$(slib_height50)/2+1],medium,50g

slib_width20=7
slib_height20=10
slib_poids20=frectangle 0,0,$(slib_width20),$(slib_height20),white\
frectangle 0,0,$(slib_width20),$(slib_height20),lightgrey\
rectangle 0,0,$(slib_width20),$(slib_height20),black\
fcircle $[$(slib_width20)/2],$[$slib_height20+1],10,black\
text black,1,$[$(slib_height20)/2+1],medium,20g

slib_width10=6
slib_height10=7
slib_poids10=frectangle 0,0,$(slib_width10),$(slib_height10),white\
frectangle 0,0,$(slib_width10),$(slib_height10),lightgrey\
rectangle 0,0,$(slib_width10),$(slib_height10),black\
fcircle $[$(slib_width10)/2],$[$slib_height10+1],10,black\
text black,0,$[$slib_height10/2+1],medium,10g

slib_width5=5
slib_height5=5
slib_poids5=frectangle 0,0,$(slib_width5),$(slib_height5),white\
frectangle 0,0,$(slib_width5),$(slib_height5),lightgrey\
rectangle 0,0,$(slib_width5),$(slib_height5),black\
fcircle $[$(slib_width5)/2],$[$slib_height5+1],7,7,black\
text black,1,$[$(slib_height5)],medium,5g

slib_width2=4
slib_height2=3
slib_poids2=frectangle 0,0,$(slib_width2),$(slib_height2),white\
frectangle 0,0,$(slib_width2),$(slib_height2),lightgrey\
rectangle 0,0,$(slib_width2),$(slib_height2),black\
fcircle $[$(slib_width2)/2],$[$slib_height2+1],5,black\
text black,1,$[$(slib_height2)],medium,2g

slib_width1=2
slib_height1=2
slib_poids1=rectangle 0,0,$(slib_width1),$(slib_height1),white\
frectangle 0,0,$(slib_width1),$(slib_height1),lightgrey\
rectangle 0,0,$(slib_width1),$(slib_height1),black\
fill 1,1,lightgrey\
fcircle $[$(slib_width1)/2],$[$slib_height1+1],5,black\
text black,1,$[$(slib_height1)],medium,1g

slib_tmp=!randint 10, 20

slib_form_g=!nosubst ftriangle 0,$[$slib_h],5,$[$slib_h+10],10,$[$slib_h],$(slib_color[1])\
frectangle 2.5,$[$slib_h],5,$[$slib_h+5],$(slib_color[1])\
fcircle 5,$[$slib_h],50,$(slib_color[1])

slib_form_d=!nosubst ftriangle 0,$[$slib_h],5,$[$slib_h+10],10,$[$slib_h],$(slib_color[2])\
frectangle 2.5,$[$slib_h],5,$[$slib_h+5],$(slib_color[2])\
fcircle 5,$[$slib_h],50,$(slib_color[2])

slib_t=0
!reset slib_g
!if $slib_objet_left!=$empty
  slib_ord=!sort numeric item $slib_left
  !for slib_u in $slib_objet_left
    !if one notwordof $slib_option
      slib_h=$[max($(slib_height$(slib_ord[-1])) + 3,$slib_tmp)]
      slib_form1=!randline $slib_form_g
    !else
      slib_h =$(slib_height500)
      slib_form1=
    !endif
    slib_g=!append line translation XXX+$slib_t,20-$slib_penche\
frectangle 0,0,10,$[$slib_h],$(slib_color[1])\
$slib_form1\
text black,5,$[$slib_h/2],large,$slib_u\
killtranslation to $slib_g
    slib_t=$[$slib_t+12]
  !next
!endif

!for slib_p in $slib_left
  slib_g=!append line translation XXX+$slib_t,$[20-$slib_penche]\
$(slib_poids$slib_p)\
killtranslation \
to $slib_g
  slib_t=$[$slib_t + $(slib_width$slib_p)-1]
!next
slib_g= !replace internal XXX by $[30-$slib_t/2] in $slib_g

slib_t=0
!reset slib_d
!if $slib_objet_right!=$empty
  slib_ord=!sort numeric item $slib_right
  !for slib_u in $slib_objet_right
    !if one notwordof $slib_option
      slib_h=$[max($(slib_height$(slib_ord[-1])) + 3,$slib_tmp)]
      slib_form1=!randline $slib_form_d
    !else
      slib_h =$(slib_height500)
      slib_form1=
    !endif
    slib_d=!append line translation XXX+$slib_t,$[20+$slib_penche]\
frectangle 0,0,10,$[$slib_h],$(slib_color[2])\
$slib_form1\
text black, 5,$[$slib_h/2],large,$slib_u\
killtranslation to $slib_d
    slib_t=$[$slib_t+12]
  !next
!endif

!for slib_p in $slib_right
  slib_d=!append line translation XXX+$slib_t,$[20+$slib_penche]\
$(slib_poids$slib_p)\
killtranslation \
to $slib_d
  slib_t=$[$slib_t + $(slib_width$slib_p) - 1]
!next
slib_d= !replace internal XXX by $[110-$slib_t/2] in $slib_d

slib_nuage=disk $[$slib_par+80],65,$[40*$slib_agr],white\
disk $[$slib_par+85],72,$[30*$slib_agr],white\
disk $[$slib_par+110],75,$[40*$slib_agr],white\
disk $[$slib_par+120],65,$[40*$slib_agr],white\
disk $[$slib_par+97],68,$[60*$slib_agr],white

slib_dessin=xrange 0,140\
yrange -10,90\
fill 0,0,skyblue\
polyline brown,5,0,30,0,35,5,105,5,110,0,135,0,120,15,20,15,5,0\
fill 20,10,blue\
$slib_nuage\
linewidth 2\
$slib_g\
$slib_d\
linewidth 2\
polyline black,5,$[25-$slib_penche],10,$[20-$slib_penche],50,$[20-$slib_penche],55,$[25-$slib_penche]\
polyline black,85,$[25+$slib_penche],90,$[20+$slib_penche],130,$[20+$slib_penche],135,$[25+$slib_penche]\
linewidth 1\
arc 70,7,24,18,0,180,black\
segment 58,7,82,7,black\
fill 75,10,white\
polyline black,30,$[20-$slib_penche],30,$[10-$slib_penche],110,$[10+$slib_penche],110,$[20+$slib_penche]\
arrow 70,10,$[70-$slib_penche],22,$[12*$slib_agr],black\
disk 30,$[10-$slib_penche],$[8*$slib_agr],black\
disk 70,10,$[8*$slib_agr],black\
disk 110,$[10+$slib_penche],$[8*$slib_agr],black\
segment 0,0,140,0,green\
fill 5,-5,green

slib_out=$slib_dessin
!if url iswordof $slib_option or html iswordof $slib_option
  insdraw_size=700,300
  !if canvasdraw isin $slib_option
    slib_out=!exec canvasdraw\
size $insdraw_size\
$slib_dessin
  !else
    !insdraw $slib_out
    slib_out=$ins_url
    !if html iswordof $slib_option
      slib_out=<img src="$ins_url" alt="">
    !else
      slib_out=$slib_out,$insdraw_size
    !endif
  !endif
!endif