File: var.prep

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 (78 lines) | stat: -rw-r--r-- 1,750 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
files=!record 1 of scenarios/$thisexo.def/.files
files=!words2items $files
file=!randitem $files

deffile=scenarios/$thisexo.def/$file
allcnt=!recordcnt $deffile
header=!record 1 of $deffile
header=!trim $header
hcnt=!linecnt $header
cc=1
!for i=7 to $hcnt
  l=!line $i of $header
  !if @ notin $l
    r$cc=!randitem $l
    !advance cc
  !else
    l=!translate @ to $\
$ in $l
    l=!trim $l
    l1=!line 1 of $l
    c1=!itemcnt $l1
    s=!randint 1,$c1
    lc=!linecnt $l
    !for j=1 to $lc
      lj=!line $j of $l
      r$cc=!item $s of $lj
      !advance cc
    !next j
  !endif
!next i

presentation=!record 2 of $deffile
good=!record 3 of $deffile
traps=!record 4 of $deffile
remarks=!record 5 of $deffile
reserved=!record 6 of $deffile
good=!trim $good
!distribute lines $header into title,author,amail,translator,tmail,format
!distribute items $ into bad_1,bad_2,bad_3,bad_4,bad_5,bad_6,bad_7,bad_8,bad_9,bad_10,bad_11,bad_12
scorecnt=0

!for i=7 to $allcnt
  t=!record $i of $deffile
  s=!item 1 of $t
  bad_$s=!append item $i to $(bad_$s)
!next i

!if $sstyle=1
  r=!random 0,1
  !distribute item $ into bad_steps, bad_reasons
  !if $r<0.75
    t=!randint 7, $allcnt
    t=!record $t of $deffile
    !distribute lines $t into l,bad_reason
    s=!item 1 of $l
    tt=!line 3 to -1 of $t
    picked=!line 1 to $s-1 of $good
    picked=!append line $tt to $picked
    n=!itemcnt $l
    !for i=1 to $n/2
      s1=!item 2*$i-1 of $l
      s2=!item 2*$i of $l
      bad_steps=!append item $s1 to $bad_steps
      bad_reasons=!append item $s2 to $bad_reasons
    !next i
  !else
    picked=$good
  !endif
  stepcnt=!linecnt $picked
  step=$stepcnt
!else
  step=1
  stepcnt=!linecnt $good
  !read scenario/var.step
!endif

status=waiting
substep=0