16 struct save_queue *sq, *load_members();
19 printf("Loading LIST members...\n");
21 printf("Computing LIST memberships...\n");
23 printf("Computing full memberships...\n");
29 struct save_queue *load_members()
31 register struct mem *m;
32 struct mem *new_mem();
33 struct save_queue *sq;
38 ## range of m is members
39 ## retrieve (lid = m.list_id, mid = m.member_id, mtype = m.member_type) {
54 static struct mem *m = NULL;
57 if (m == NULL || count <= 0) {
58 m = malloc(100 * sizeof(struct mem));
60 printf("Out of memory!\n");
72 struct save_queue *sq;
75 ## int cid, pid, id, exists;
76 int descendants[MAXLINK], ancestors[MAXLINK];
77 int dcount, acount, a, d;
79 ## range of m is imembers
80 while (sq_get_data(sq, &m)) {
86 descendants[dcount++] = cid;
87 ## repeat retrieve (id = m.member_id)
88 ## where m.list_id = @cid {
89 descendants[dcount++] = id;
92 ancestors[acount++] = pid;
93 ## repeat retrieve (id = m.list_id)
94 ## where m.member_id = @pid {
95 ancestors[acount++] = id;
97 if (dcount >= MAXLINK | acount >= MAXLINK)
98 printf("too many links working on %d -> %d\n", cid, pid);
99 for (d = 0; d < dcount; d++) {
100 for (a = 0; a < acount; a++) {
101 if ((cid = descendants[d]) == (pid = ancestors[a]))
102 printf("LOOP! on %d\n", cid);
103 ## repeat retrieve (exists = any(m.ref_count where m.list_id = @pid
104 ## and m.member_id = @cid
105 ## and m.member_type = "LIST"))
107 if (a == 0 && d == 0)
108 ## replace m (ref_count = m.ref_count+1, direct = 1)
109 ## where m.list_id = pid and m.member_id = cid
111 ## replace m (ref_count = m.ref_count+1)
112 ## where m.list_id = pid and m.member_id = cid
114 if (a == 0 && d == 0)
115 ## append imembers (list_id=pid, member_id = cid, direct = 1,
116 ## member_type="LIST", ref_count = 1)
118 ## append imembers (list_id=pid, member_id = cid,
119 ## member_type="LIST", ref_count = 1)
129 struct save_queue *sq;
132 register struct mem *m;
133 ## int cid, pid, id, exists;
135 int descendants[MAXLINK], ancestors[MAXLINK];
136 int dcount, acount, a, d;
138 ## range of m is imembers
139 sq->q_lastget = 0; /* rewind queue */
140 while (sq_get_data(sq, &mem)) {
155 printf("bad type %c on member %d\n", m->ctype, m->child);
161 ancestors[acount++] = pid;
162 ## repeat retrieve (id = m.list_id)
163 ## where m.member_id = @pid and m.member_type = "LIST" {
164 ancestors[acount++] = id;
166 if (acount >= MAXLINK)
167 printf("too many links working on %d -> %d\n", cid, pid);
168 for (a = 0; a < acount; a++) {
170 ## repeat retrieve (exists = any(m.ref_count where m.list_id = @pid
171 ## and m.member_id = @cid
172 ## and m.member_type = @ctype))
175 ## replace m (ref_count = m.ref_count+1, direct = 1)
176 ## where m.list_id = pid and m.member_id = cid
178 ## replace m (ref_count = m.ref_count+1)
179 ## where m.list_id = pid and m.member_id = cid
182 ## append imembers (list_id=pid, member_id = cid, direct = 1,
183 ## member_type=ctype, ref_count = 1)
185 ## append imembers (list_id=pid, member_id = cid,
186 ## member_type=ctype, ref_count = 1)