File: sheetexam.shift

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 (90 lines) | stat: -rw-r--r-- 2,604 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
!!
!! move a field of a .sheet$sheet or .exam$exam to another position
!! keep correct score dependancy
!! input parameter :
!! item 1 : word exam or word sheet (...)
!! item 2 : num of exam or sheet to be tranform
!! item 3 : the position where the field be inserted after (next are translated). if empty, the field is deleted if 0 the field is placed in first position
!! item 4 : the position of the source field 
!! wims_read_parm : name of record

!distribute item $wims_read_parm into type_,num_,target_,source_
!! line number containt score dependancy (not same for exam and sheet)
!if $type_=sheet
  li_=7
!else
  li_=4
!endif
ecnt_=!recordcnt wimshome/log/classes/$wims_class/$(type_)s/.$(type_)$num_
!for e_=1 to $ecnt_
  field_$e_=!record $e_ of wimshome/log/classes/$wims_class/$(type_)s/.$(type_)$num_
  field_$e_=!line 1 to 11 of $(field_$e_)\
\
\
\
\
\
\
\


!next e_
list_=!values v for v=1 to $ecnt_
list_=!replace item number $source_ by $empty in $list_
!if $target_!=$empty
  !if $target_=0
    list_=$source_,$list_
  !else
    !if $target_=$[$ecnt_+1]
      list_=$list_,$source_
    !else
      !if $target_!=$empty
        !if $target_<$source_
          list_=!replace item $target_ by $source_,$target_ in $list_
        !else
          list_=!replace item $target_ by $target_,$source_ in $list_
        !endif
      !endif
    !endif
  !endif
!endif
list_=!nonempty item $list_
mlist_=$empty
!for i_=1 to $ecnt_
  p_=!positionof item $i_ in $list_
  !if $p_=$empty
    p_=EMPTY
  !endif
  mlist_=!append item $p_ to $mlist_
!next i_
ecnt_=!itemcnt $list_
!writefile wimshome/log/classes/$wims_class/$(type_)s/.$type_$num_ $empty
!for e_=1 to $ecnt_
  !! ------- check for score dependancy
  sco_=!line $li_ of $(field_$(list_[$e_]))
  !if $sco_!=$empty
    nsco_=$empty
    sco_=!items2lines $sco_
    sco_=!replace internal : by , in $sco_
    sco_=!replace internal + by , in $sco_
    nbl_=!linecnt $sco_
    !for i_=1 to $nbl_
      nbi_=!itemcnt $(sco_[$i_;])
      nli_=$empty
      !for j_=1 to $nbi_-1
        !if $(mlist_[$(sco_[$i_;$j_])])!=EMPTY
          nli_=!append item $(mlist_[$(sco_[$i_;$j_])]) to $nli_
        !endif
      !next j_
      nli_=!nonempty item $nli_
      nli_=!replace internal , by + in $(nli_)
      !if $nli_!=$empty
        nli_=$nli_:$(sco_[$i_;$nbi_])
        nsco_=!append item $nli_ to $nsco_
      !endif
    !next i_
    field_$(list_[$e_])=!replace line number $li_ by $nsco_ in $(field_$(list_[$e_]))
  !endif
  !! save field
  !appendfile wimshome/log/classes/$wims_class/$(type_)s/.$type_$num_ :$(field_$(list_[$e_]))
!next e_