File: addallexo.proc

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 (198 lines) | stat: -rw-r--r-- 5,769 bytes parent folder | download | duplicates (2)
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
!if $step=$empty
    step=1
!endif

max_exos=!defof MAX_EXOS in wimshome/public_html/bases/sys/define.conf
max_sheets=!defof MAX_SHEETS in wimshome/public_html/bases/sys/define.conf
title_limit=50
desc_limit=255

!if $scoring=yes
  !default require=10
  !default weight=1
!else
  require=0
  weight=0
!endif

!if $step=1
  sheets=
  !for i=1 to $sheettot
    sh=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
    !distribute lines $sh into a_,t_,title
    !if $a_<1
      sheets=!append line $i,$title to $sheets
    !endif
  !next i
  sheetcnt=!linecnt $sheets
  !ifval $sheetcnt=0
    error=no_sheet
    !exit
  !endif
  special_parm2=expert
  smodule=$dir
  !distribute line $wims_oefdefault_qnum\
$wims_oefdefault_qcmlevel\
$wims_oefdefault_scoredelay\
$wims_oefdefault_qcmpresent\
$wims_oefdefault_sol\
$wims_oefdefault_check\
$wims_oefdefault_expow\
$wims_oefdefault_sepow\
$wims_oefdefault_precw\
$wims_oefdefault_feed\
$wims_oefdefault_good\
$wims_oefdefault_hint\
  into qnum,qcmlevel,scoredelay,intro_qcmpresent,intro_sol,intro_check,\
  intro_expow,intro_sepow,intro_precw,intro_feed,intro_good,intro_hint
!endif

!! calcul du nombre d'exercices
!if /////classes/ isin /////$smodule
    !! adresse du module d'exo d'une classe
  dir_header=wimshome/log/classes/$wims_class
!else
    !! adresse d'un module public ou modtool
  dir_header=wimshome/public_html/modules/$smodule
!endif
exolist=!defof exolist in $dir_header/Exindex
exolist=!char 17 to -2 of $exolist
exotitle=!defof titlelist in $dir_header/Exindex
exotitle=!char 17 to -2 of $exotitle
exocnt=!itemcnt $exolist

!if $step=2
!! vrification des donnes de feuille.
  !if $picksheet=$empty
    error=no_pick
    !exit
  !endif
  picksheet=$[floor($picksheet)]
  !if $picksheet=NaN or $picksheet<1 or $picksheet>min($max_sheets,$sheettot)
    error=bad_sheet
    !exit
  !endif
  sh=!record $picksheet of wimshome/log/classes/$wims_class/sheets/.sheets
  a=!line 1 of $sh
  !if $a>0
    error=bad_sheet
    !exit
  !endif
  shexocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
  !if $exocnt+$shexocnt>$max_exos
    error=too_many_exos
    !exit
  !endif
  !if $scoring=yes
    require=$[$require]
    weight=$[$weight]
    !if NaN isin $require
      require=0
    !endif
    !if NaN isin $weight
      weight=0
    !endif
    !bound require between 0 and $[10*$require_limit] default 0
    !bound weight between 0 and 10 default 0
  !endif
!! vrification des donnees d'execution du module d'exo
  test_transl=!module translation_language $dir
  !if $lang iswordof $test_transl
    tr_lang=yes
    title=!module title_$lang $dir
    desc=!module description_$lang $dir
  !endif
  !default title=!module title $dir
  !default desc=!module description $dir
  desc_module=$desc
  cat=!module category $dir
  !if exercise notin $cat and oef notin $cat
    error=not_exo
    !exit
  !endif
  !bound qnum between integer 1 and 9 default $wims_oefdefault_qnum
  !bound qcmlevel between integer 1 and 9 default $wims_oefdefault_qcmlevel
  !bound intro_qcmpresent between integer 2 and 8 default $wims_oefdefault_qcmpresent
  !bound intro_presentsol between integer 0 and 2 default $wims_oefdefault_presentsol
  !bound intro_expow between 1 and 6 default $wims_oefdefault_expow
  !bound intro_sepow between 1 and 6 default $wims_oefdefault_sepow
  !bound intro_precw between 0 and 1 default $wims_oefdefault_precw

  intro_check=!listintersect $intro_check and 1,2
  !bound random within 0,1 default 0
  !if $scoredelay!=$empty and $scoredelay!=0
    d_=!items2words $scoredelay
    !distribute words $d_ into delay1,delay2
    !bound delay1 between integer 0 and 2000 default 0
    !bound delay2 between integer $delay1 and 2000
    scoredelay=$delay1,$delay2
  !endif

  iniparm=$empty
  !if $expert_=yes
    !if $intro_check!=$empty
      !for k in $intro_check
        iniparm=$(iniparm)&intro_check=$k
      !next k
    !endif
    !for c in expow,sepow,precw,sol,hint,good,feed,qcmpresent
      iniparm=$(iniparm)&intro_$c=$(intro_$c)
    !next
  !endif
  iniparm=qnum=$qnum&qcmlevel=$qcmlevel&scoredelay=$scoredelay&seedrepeat=$seedrepeat$iniparm

  !! ------  write data in the sheet file.
  !! analyse series already in the sheet
  listmod=$empty
  listiniparm=$empty
  !for i=1 to $shexocnt
    e=!record $i of wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
    !distribute lines $e into wdi,win
    listmod=!append line $wdi to $listmod
    listiniparm=!append line $win to $listiniparm
  !next i
  !! Ecriture
  writedon=$empty
  listalready=$empty
  !for j=1 to $exocnt
    ex=!item $j of $exolist
    lerror=0
    exoiniparm=exo=$ex&$iniparm
    !for i=1 to $shexocnt
      wdi=!line $i of $listmod
      win=!line $i of $listiniparm
      !if $smodule=$wdi and $exoiniparm=$win
        lerror=1
      !endif
    !next i
    !if $lerror=1
      listalready=!append item $ex to $listalready
    !else
      !reset desc
      desc_=!lookup $ex in wimshome/public_html/modules/$smodule/Descindex
      !if $desc_!=$empty
        desc=$desc_
      !endif
      !default desc=$desc_module
      obs_=!lookup $ex in wimshome/public_html/modules/$smodule/Obsindex
      writedon=!append line :$smodule\
$exoiniparm\
$require\
$weight\
$(exotitle[$j])\
$desc\
\
$obs_\
 to $writedon
    !endif
  !next j
  !if $writedon!=$empty
    !appendfile wimshome/log/classes/$wims_class/sheets/.sheet$picksheet $writedon
  !endif
  last=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
  notadd=!itemcnt $listalready
  addexo=$[$exocnt-$notadd]
  wims_module_log=class $class: add  No$[$last-$addexo+1] to No$last to worksheet $picksheet
  sh=!record $picksheet of wimshome/log/classes/$wims_class/sheets/.sheets
  title=!line 3 of $sh
!endif