File: stopshare

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 (140 lines) | stat: -rw-r--r-- 2,812 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
!! Stop sharing between two classes.
!! Calling parameters: 2 lines.
!! Line 1: initiating class, destination class
!! Line 2: list of resources to share.

as_1=!translate internal , to $ $ in $wims_read_parm
!distribute lines $as_1 into as_1,as_l
!distribute words $as_1 into as_1,as_2
as_l=!words2items $as_l

as_t_exo=src def Exindex Extitles
as_t_sheet=sheets
as_t_exam=exams
as_t_vote=vote
as_t_doc=doc
as_t_forum=forum
as_t_user=.users .userlist .userlist_external
as_t_motd=.motd
as_t_sup=supervisor
as_t_cdt=cdt
as_t_livret=livret
as_t_seq=seq
as_t_userphoto=photoboard
as_t_tool=tool
as_list=exo,sheet,exam,vote,doc,forum,user,motd,sup,cdt,livret,seq,userphoto,tool
!!to fix if the list is changed ....
!for tmp in $as_list
  !default as_t_$tmp=$tmp
!endif
!if sharing notwordof $wims_prefix
  wims_prefix=$wims_prefix n sharing sharable
!endif

!if all isitemof $as_l
  as_l=$as_list
!else
  !if exo isitemof $as_l
    as_l=!listunion $as_l and sheet
  !endif
  !if sheet iswordof $as_l
    as_l=!listunion $as_l and exam
  !endif
!endif

1_=!translate internal / to , in $as_1
2_=!translate internal / to , in $as_2
1=!itemcnt $1_
2=!itemcnt $2_
3=$[min($1,$2)]

!for i=1 to $3+1
  !if $(1_[$i]) != $(2_[$i])
    !break
  !endif
!next i

1_=!item $i to -1 of $1_
!if $i<=$2
  4_=!makelist .. for x=$i to $2
  1_=$4_,$1_
!endif
1_=!nonempty items $1_
1_=!nospace $1_
1_=!translate internal , to / in $1_

!for t in $as_list
  !reset sharing_$t
!next t
!readdef wimshome/log/classes/$as_2/neighbors
as_l1=
!for t in $as_l
  !if $(sharing_$t) = $as_1
    as_l1=!append item $t to $as_l1
  !endif
!next t
as_l=$as_l1
!if $as_l=$empty
  error=stopshare_notsharing
  !exit
!endif

L_=
!for t in $as_list
  !if $t isitemof $as_l
    L_=$L_ $(as_t_$t)
  !endif
!next t
!if $L_=$empty
  !exit
!endif

!goto skip_sharable
!for t in $as_list
  !reset sharable_$t
!next t
!readdef wimshome/log/classes/$as_1/neighbors
as_=
!for t in $as_l
  sharable_$t=!listcomplement $as_2 in $(sharable_$t)
  as_=$as_\
sharable_$t=$(sharable_$t)
!next t
as_all=
!for t in $as_list
  as_all=$as_all,$(sharing_$t)
!next t
!if $as_2 notitemof $as_all
  sharable_all=!listcomplement $as_2 in $sharable_all
  as_=$as_\
sharable_all=$sharable_all
!endif
!setdef $as_ in wimshome/log/classes/$as_1/neighbors
:skip_sharable

!for t in $as_list
  !reset sharing_$t
!next t
!readdef wimshome/log/classes/$as_2/neighbors
as_=
!for t in $as_l
  sharing_$t=
  as_=$as_\
sharing_$t=
!next t
as_all=
!for t in $as_list
  as_all=$as_all,$(sharing_$t)
!next t
!if $as_1 notitemof $as_all
  sharing_all=!listcomplement $as_1 in $sharing_all
  as_=$as_\
sharing_all=$sharing_all
!endif
!setdef $as_ in wimshome/log/classes/$as_2/neighbors

!sh cd $wims_home/log/classes/$as_2\
 rm -Rf $L_\
 for f in $L_; do\
  cp -R $1_/$$f . 2>/dev/null\
 done