1 #include "def.h"
2 #include "macro.h"
3 
4 static INT hash1();
5 static INT eq1();
6 static OP lookup2=NULL;
7 static OP lookup1=NULL;
8 
9 INT t_HASHTABLE_POLYNOM_apply();
10 
hash_ende()11 INT hash_ende()
12 {
13     INT erg = OK;
14     if (lookup2 != NULL) {
15         INT i;
16         for (i=0;i<3;i++)
17              C_O_K(S_V_I(lookup2,i),EMPTY);
18         FREEALL(lookup2);
19         lookup2=NULL;
20         }
21     if (lookup1 != NULL) {
22         INT i;
23         for (i=0;i<2;i++)
24              C_O_K(S_V_I(lookup1,i),EMPTY);
25         FREEALL(lookup1);
26         lookup2=NULL;
27         }
28     ENDR("hash_ende");
29 }
30 
copy_hashtable(a,b)31 INT copy_hashtable(a,b) OP a,b;
32 /* AK 011101 */
33 {
34     INT erg = OK;
35     INT i;
36     OP ap,bp;
37     CTO(HASHTABLE,"copy_hashtable(1)",a);
38     CTO(EMPTY,"copy_hashtable(2)",b);
39 
40     erg += m_il_v(S_V_LI(a)+1,b);
41     C_O_K(b,HASHTABLE);
42     DEC_INTEGER(S_V_L(b));
43     M_I_I(WEIGHT_HASHTABLE(a), S_V_I(b,S_V_LI(b)));
44 
45     for (ap=S_V_S(a), bp = S_V_S(b), i=S_V_LI(b); i>0 ;i--,ap++,bp++)
46        {
47        if (not EMPTYP(ap))
48            erg += copy_vector(ap,bp);
49        else
50            C_I_I(bp,S_I_I(ap));
51        }
52     ENDR("copy_hashtable");
53 }
54 
mem_size_hashtable(a)55 INT mem_size_hashtable(a) OP a;
56 /* AK 080903 */
57 {
58     INT erg = OK, res = 0;
59     CTO(HASHTABLE,"mem_size_hashtable(1)",a);
60     res = mem_size_vector(a);
61     res += sizeof(struct object); /* length of hashtable as appendix */
62     return res;
63     ENDR("mem_size_hashtable");
64 }
65 
mult_apply_scalar_hashtable(a,b)66 INT mult_apply_scalar_hashtable(a,b) OP a,b;
67 /* AK 171001 */
68 {
69     INT erg = OK;
70     OP z;
71 
72     CTO(HASHTABLE,"mult_apply_scalar_hashtable(1)",b);
73 
74     FORALL(z,b, {
75         MULT_APPLY(a,z);
76         } );
77 
78     CTO(HASHTABLE,"mult_apply_scalar_hashtable(1-end)",b);
79     ENDR("mult_apply_scalar_hashtable");
80 }
81 
mult_apply_integer_hashtable(a,b)82 INT mult_apply_integer_hashtable(a,b) OP a,b;
83 /* AK 171001 */
84 {
85     INT erg = OK;
86     OP z;
87 
88     CTO(HASHTABLE,"mult_apply_integer_hashtable(2)",b);
89     CTO(INTEGER,"mult_apply_integer_hashtable(1)",a);
90 
91     FORALL(z,b, {
92         MULT_APPLY_INTEGER(a,z);
93         } );
94 
95     ENDR("mult_apply_integer_hashtable");
96 }
97 
mult_integer_hashtable(a,b,c)98 INT mult_integer_hashtable(a,b,c) OP a,b,c;
99 /* AK 310102 */
100 {
101     INT erg = OK;
102     OP z;
103 
104     CTO(HASHTABLE,"mult_integer_hashtable(2)",b);
105     CTO(INTEGER,"mult_integer_hashtable(1)",a);
106     CTO(EMPTY,"mult_integer_hashtable(3)",c);
107 
108     erg += copy_hashtable(b,c);
109 
110     FORALL(z,c, {
111         MULT_APPLY_INTEGER(a,z);
112         } );
113 
114     ENDR("mult_integer_hashtable");
115 }
116 
mult_bruch_hashtable(a,b,c)117 INT mult_bruch_hashtable(a,b,c) OP a,b,c;
118 /* AK 310102 */
119 {
120     INT erg = OK;
121     OP z;
122 
123     CTO(HASHTABLE,"mult_bruch_hashtable(2)",b);
124     CTO(BRUCH,"mult_bruch_hashtable(1)",a);
125     CTO(EMPTY,"mult_bruch_hashtable(3)",c);
126 
127     erg += copy_hashtable(b,c);
128 
129     FORALL(z,c, {
130         MULT_APPLY_BRUCH(a,z);
131         } );
132 
133     ENDR("mult_bruch_hashtable");
134 }
135 
136 
137 
mult_apply_bruch_hashtable(a,b)138 INT mult_apply_bruch_hashtable(a,b) OP a,b;
139 /* AK 171001 */
140 {
141     INT erg = OK;
142     OP z;
143 
144     CTO(HASHTABLE,"mult_apply_bruch_hashtable(2)",b);
145     CTO(BRUCH,"mult_apply_bruch_hashtable(1)",a);
146 
147     FORALL(z,b, {
148         MULT_APPLY_BRUCH(a,z);
149         } );
150 
151     ENDR("mult_apply_bruch_hashtable");
152 }
153 
154 
155 
addinvers_apply_hashtable(a)156 INT addinvers_apply_hashtable(a) OP a;
157 /* AK 231001 */
158 {
159     INT erg = OK;
160     OP z;
161     CTO(HASHTABLE,"addinvers_apply_hashtable(1)",a);
162 
163     FORALL(z,a, {
164         ADDINVERS_APPLY(z);
165         } );
166 
167     ENDR("addinvers_apply_hashtable");
168 }
169 
170 
add_apply_hashtable(a,b,eh,ef,hf)171 INT add_apply_hashtable(a,b,eh,ef,hf) OP a,b; INT (*ef)();INT (*hf)(); INT (*eh)();
172 /* AK 141101 */
173 /* first lookup a in b, if not yet here it inserts a copy, else
174    it applys the eh function */
175 {
176     INT erg = OK;
177     OP z;
178     CTO(HASHTABLE,"add_apply_hashtable(2)",b);
179     z = find_hashtable(a,b,ef,hf);
180     if (z == NULL) {
181         OP m;
182         m = CALLOCOBJECT();
183         COPY(a,m);
184         INSERT_HASHTABLE(m,b,eh,ef,hf);
185         }
186     else {
187         if (eh == NULL) ;
188         else if (eh == add_koeff) {
189             ADD_KOEFF(a,z);
190             if (EMPTYP(z))
191                 DEC_INTEGER(S_V_I(b,S_V_LI(b))); /* counter-- */
192             }
193         else {
194             (*eh)(a,z);
195             if (EMPTYP(z))
196                 DEC_INTEGER(S_V_I(b,S_V_LI(b))); /* counter-- */
197             }
198         }
199     ENDR("add_apply_hashtable");
200 }
201 
202 
find_hashtable(a,b,ef,hf)203 OP find_hashtable(a,b,ef,hf) OP a,b; INT (*ef)();INT (*hf)();
204 /* AK 281097 */
205 /* find a object in hashtable b */
206 /* return s NULL if not find, else returns OP pointer */
207 {
208     OP z,z1;
209     INT i,hi,hh,hhh;
210     INT erg = OK;
211 
212     CTO(HASHTABLE,"find_hashtable(2)",b);
213     if (hf == NULL) hf = hash;
214 
215     if (hf == hash_monompartition)
216         hh = HASH_MONOMPARTITION(a);
217     else if (hf == hash)
218         hh = HASH(a);
219     else if (hf == hash1)
220         hh = HASH(S_V_I(a,0));
221     else
222         hh = (*hf)(a);
223 
224     hi = hh % S_V_LI(b);
225     if (hi < 0)
226          hi += S_V_LI(b);
227 
228 
229     z = S_V_I(b,hi);
230 
231     if (EMPTYP(z)) return NULL;
232 
233     for (i=0,z1 = S_V_S(z) ;i<S_V_LI(z);i++,z1++)
234         if (not EMPTYP(z1))
235             {
236             if (hf == hash)
237                 hhh = HASH(z1);
238             else if (hf == hash_monompartition)
239                 hhh = HASH_MONOMPARTITION(z1);
240             else if (hf == hash1)
241                 hhh = HASH(S_V_I(z1,0));
242             else
243                 hhh = (*hf)(z1);
244 
245             if (hh == hhh)
246                 {
247                 if (ef == NULL)
248                     hhh = EQ(a,z1);
249                 else if (ef == eq_monomsymfunc)
250                     hhh = eq_partition_partition(S_MO_S(a),S_MO_S(z1));
251                 else if (ef == eq1)
252                     hhh = EQ(S_V_I(a,0),S_V_I(z1,0));
253                 else
254                     hhh = (*ef)(a,z1);
255 
256                 if (hhh == TRUE) return z1;
257                 }
258             }
259 
260     return NULL;
261     ENDO("find_hashtable");
262 }
263 
264 
fprint_hashtable(f,h)265 INT fprint_hashtable(f,h) FILE *f; OP h;
266 /* AK 131101 */
267 {
268     INT erg = OK;
269     OP z;
270     COP("fprint_hashtable(1)",f);
271     CTO(HASHTABLE,"fprint_hashtable(2)",h);
272 
273     fprintf(f,"s=");
274     erg += fprint(f,S_V_I(h,S_V_LI(h)));
275     fprintf(f," ");
276     if (f == stdout) zeilenposition += 3;
277 
278     FORALL(z,h, {
279         fprint(f,z); fprintf(f," ");
280         if (f == stdout) zeilenposition ++;
281         });
282     ENDR("fprint_hashtable");
283 }
284 
objectread_hashtable(fp,h)285 INT objectread_hashtable(fp, h) FILE *fp; OP h;
286 /* AK 100307 */
287 {
288 	INT erg = OK,i,j=-1,k;
289 	erg += objectread_vector(fp,h);
290 	/* next pointer update */
291 	M_I_I(S_V_LI(h)-1,S_V_L(h));
292 	for (i=0;i<S_V_LI(h);i++)
293 		{
294 		if (S_O_K(S_V_I(h,i))  == VECTOR)
295 			{
296 			for (j++;j<i;j++)
297 				C_I_I(S_V_I(h,j),i);
298 			}
299 		}
300 	// printf("j=%d i=%d\n",j,i);
301 	for (j++;j<i;j++)
302 		C_I_I(S_V_I(h,j),-1);
303 	M_I_I(S_V_LI(h)+1,S_V_L(h));
304 /*
305 	for (i=0;i<S_V_LI(h);i++) if (not EMPTYP(S_V_I(h,i))) println(S_V_I(h,i));
306 				  else printf("%d\n",S_V_II(h,i));
307 */
308 	M_I_I(S_V_LI(h)-1,S_V_L(h));
309 	C_O_K(h,HASHTABLE);
310 	// println(h);
311 	ENDR("objectread_hashtable");
312 }
313 
objectwrite_hashtable(fp,h)314 INT objectwrite_hashtable(fp, h) FILE *fp; OP h;
315 /* AK 100307 */
316 {
317         INT erg = OK;
318         M_I_I(S_V_LI(h)+1,S_V_L(h));
319         erg += objectwrite_vector(fp,h);
320         M_I_I(S_V_LI(h)-1,S_V_L(h));
321         ENDR("objectread_hashtable");
322 }
323 
324 
325 
326 #define INIT_HASH_TABLE_SIZE(a,i)\
327 do { \
328     INT ihts_i; OP ihts_z;\
329     erg += m_il_v(i+1,a);\
330     M_I_I(i,S_V_L(a));\
331     C_O_K(a,HASHTABLE);\
332     for (ihts_i=0,ihts_z=S_V_S(a);ihts_i<i;ihts_i++,ihts_z++) \
333         { ihts_z->ob_self.ob_INT  = -1; }\
334     M_I_I(0,S_V_I(a,i)); \
335 } while(0)
336 
init_hashtable(a)337 INT init_hashtable(a) OP a;
338 /* AK 281097 */
339 /* initialize a hashtable */
340     {
341     INT erg = OK;
342     CTO(EMPTY,"init_hashtable(1)",a);
343     INIT_HASH_TABLE_SIZE(a,1009);
344     ENDR("init_hashtable");
345     }
346 
347 
init_size_hashtable(a,b)348 INT init_size_hashtable(a,b) OP a; INT b;
349     {
350     OP c;
351     INT erg = OK;
352     SYMCHECK( b < 1, "non positive size in init_size_hashtable(2)");
353 
354     NEW_INTEGER(c,b);
355     while (not primep(c)) INC_INTEGER(c);
356     INIT_HASH_TABLE_SIZE(a,S_I_I(c));
357     FREEALL(c);
358     ENDR("init_size_hashtable");
359     }
360 
clone_size_hashtable(a,b)361 INT clone_size_hashtable(a,b) OP a; INT b;
362     {
363     INT erg = OK;
364     CTO(EMPTY,"clone_size_hashtable(1)",a);
365     CTO(INTTYPE,"clone_size_hashtable(2)",b);
366     INIT_HASH_TABLE_SIZE(a,b);
367     ENDR("clone_size_hashtable");
368     }
369 
370 
371 
insert_hashtable_hashtable(a,b,eh,cf,hf)372 INT insert_hashtable_hashtable(a,b,eh , cf,hf) OP a,b; INT (*eh)(), (*cf)(), (*hf)();
373 {
374     INT erg = OK;
375     OP z;
376     CTO(HASHTABLE,"insert_hashtable_hashtable(1)",a);
377     CTO(HASHTABLE,"insert_hashtable_hashtable(2)",b);
378 
379     FORALL(z,a, {
380         OP f;
381         f = CALLOCOBJECT();
382         SWAP(z,f);
383         insert_scalar_hashtable(f,b,eh , cf,hf);
384         } );
385 
386     M_I_I(0,S_V_I(a,S_V_LI(a)));
387     FREEALL(a);
388     ENDR("insert_hashtable_hashtable");
389 }
390 
391 #define INSERT_SF_HASHTABLE(a,b,eh , cf,hf)\
392 do {OP z; \
393     z = a;\
394     if (S_L_S(z) != NULL)\
395     while (z!= NULL)\
396         {\
397         erg +=  insert_scalar_hashtable(S_L_S(z), b,eh , cf,hf);\
398         C_L_S(z,NULL);\
399         z = S_L_N(z);\
400         }\
401     FREEALL(a); \
402     } while(0)
403 
insert_monomial_hashtable(a,b,eh,cf,hf)404 INT insert_monomial_hashtable(a,b,eh , cf,hf) OP a,b; INT (*eh)(), (*cf)(), (*hf)();
405 /* AK 131101 */
406 {
407     INT erg = OK;
408     CTO(MONOMIAL,"insert_monomial_hashtable(1)",a);
409     CTO(HASHTABLE,"insert_monomial_hashtable(2)",b);
410     INSERT_SF_HASHTABLE(a,b,eh , cf,hf);
411     ENDR("insert_monomial_hashtable");
412 }
413 
insert_schur_hashtable(a,b,eh,cf,hf)414 INT insert_schur_hashtable(a,b,eh , cf,hf) OP a,b; INT (*eh)(), (*cf)(), (*hf)();
415 /* AK 131101 */
416 {
417     INT erg = OK;
418     CTO(SCHUR,"insert_schur_hashtable(1)",a);
419     CTO(HASHTABLE,"insert_schur_hashtable(2)",b);
420     INSERT_SF_HASHTABLE(a,b,eh , cf,hf);
421     ENDR("insert_schur_hashtable");
422 }
423 
insert_homsym_hashtable(a,b,eh,cf,hf)424 INT insert_homsym_hashtable(a,b,eh , cf,hf) OP a,b; INT (*eh)(), (*cf)(), (*hf)();
425 /* AK 131101 */
426 {
427     INT erg = OK;
428     CTO(HOMSYM,"insert_homsym_hashtable(1)",a);
429     CTO(HASHTABLE,"insert_homsym_hashtable(2)",b);
430     INSERT_SF_HASHTABLE(a,b,eh , cf,hf);
431     ENDR("insert_homsym_hashtable");
432 }
433 
insert_powsym_hashtable(a,b,eh,cf,hf)434 INT insert_powsym_hashtable(a,b,eh , cf,hf) OP a,b; INT (*eh)(), (*cf)(), (*hf)();
435 /* AK 131101 */
436 {
437     INT erg = OK;
438     CTO(POWSYM,"insert_powsym_hashtable(1)",a);
439     CTO(HASHTABLE,"insert_powsym_hashtable(2)",b);
440     INSERT_SF_HASHTABLE(a,b,eh , cf,hf);
441     ENDR("insert_powsym_hashtable");
442 }
443 
insert_elmsym_hashtable(a,b,eh,cf,hf)444 INT insert_elmsym_hashtable(a,b,eh , cf,hf) OP a,b; INT (*eh)(), (*cf)(), (*hf)();
445 /* AK 131101 */
446 {
447     INT erg = OK;
448     CTO(ELMSYM,"insert_elmsym_hashtable(1)",a);
449     CTO(HASHTABLE,"insert_elmsym_hashtable(2)",b);
450     INSERT_SF_HASHTABLE(a,b,eh , cf,hf);
451     ENDR("insert_elmsym_hashtable");
452 }
453 
454 
455 
insert_hashtable(a,b,eh,cf,hf)456 INT insert_hashtable(a,b,eh , cf,hf) OP a,b; INT (*eh)(), (*cf)(), (*hf)();
457 /* AK 281097 */
458 /* insert into a hashtable */
459 /* AK 131101 */
460 {
461     INT erg = OK;
462     CTO(HASHTABLE,"insert_hashtable(2)",b);
463 
464     if (S_O_K(a) == HASHTABLE)
465         erg += insert_hashtable_hashtable(a,b,eh,cf,hf);
466     else if (S_O_K(a) == MONOMIAL)
467         erg += insert_monomial_hashtable(a,b,eh,cf,hf);
468     else if (S_O_K(a) == SCHUR)
469         erg += insert_schur_hashtable(a,b,eh,cf,hf);
470     else if (S_O_K(a) == ELMSYM)
471         erg += insert_elmsym_hashtable(a,b,eh,cf,hf);
472     else if (S_O_K(a) == HOMSYM)
473         erg += insert_homsym_hashtable(a,b,eh,cf,hf);
474     else if (S_O_K(a) == POWSYM)
475         erg += insert_powsym_hashtable(a,b,eh,cf,hf);
476     else
477         erg += insert_scalar_hashtable(a,b,eh,cf,hf);
478 
479     ENDR("insert_hashtable");
480 }
481 
insert_scalar_hashtable(a,b,eh,ef,hf)482 INT insert_scalar_hashtable(a,b,eh,ef,hf)  OP a,b; INT (*eh)(), (*ef)(), (*hf)();
483 /* AK 281097 */
484 /* AK 131101 */
485 {
486     INT i,index,freeindex=-1,hv,hvv;
487     INT erg = OK;
488     OP z,zz;
489 
490     COP("insert_scalar_hashtable(1)",a);
491     CTO(HASHTABLE,"insert_scalar_hashtable(2)",b);
492     /* einfach einfuegen */
493 
494 
495     if (hf == NULL) hf = hash;
496     if (hf == hash)
497         hv = HASH(a);
498     else if (hf == hash_monompartition)
499         hv = HASH_MONOMPARTITION(a);
500     else
501         hv =  (*hf)(a);
502     index = hv % S_V_LI(b);
503 
504     if (index < 0) index += S_V_LI(b);
505     z = S_V_I(b,index);
506 
507     if (EMPTYP(z))
508         {
509         B_O_V(a,z);
510         INC_INTEGER(S_V_I(b,S_V_LI(b))); /* counter++ */
511         for (zz=S_V_I(b,index-1),i=index-1; i>=0; i--,zz--)
512             if (EMPTYP(zz)) S_O_S(zz).ob_INT=index;
513             else break;
514         }
515     else    {
516         /* collision test */
517         if (ef == NULL) ef = eq;
518         for (zz= S_V_I(z,S_V_LI(z)-1),i=S_V_LI(z)-1;i>=0;i--,zz--)
519             {
520             if (EMPTYP(zz))
521                 freeindex = i;
522             else {
523                  if (hf == hash)
524                      hvv=HASH(zz);
525                  else if (hf == hash_monompartition)
526                      hvv=HASH_MONOMPARTITION(zz);
527                  else
528                      hvv=(*hf)(zz);
529                  if (
530                      (hv == hvv)
531                      &&
532                      ((*ef)(a,zz) == TRUE)
533                     )
534                     {
535                     /* there is a collision */
536                     if (eh != NULL) {
537                          if (eh == add_koeff) {ADD_KOEFF(a,zz);}
538                          else (*eh)(a,zz);
539                          FREEALL(a);
540                          if (EMPTYP(zz))
541                             DEC_INTEGER(S_V_I(b,S_V_LI(b))); /* counter-- */
542                          }
543                     else
544                         { FREEALL(a); }
545                     goto ende;
546                     }
547                 }
548             }
549         /* nicht da */
550         if (freeindex < 0) { freeindex = S_V_LI(z); inc_vector_co(z,3); }
551 
552 
553         INC_INTEGER(S_V_I(b,S_V_LI(b))); /* counter++ */
554         SWAP(a,S_V_I(z,freeindex));
555         FREEALL(a);
556         }
557 
558     /* AK 240901 */
559     /* if the table is full, i.e. number of entires > length
560        increase the size by factor 2 */
561     if (
562         (S_V_LI(b) < WEIGHT_HASHTABLE(b))
563        )
564         erg += double_hashtable(b,hf);
565 
566 ende:
567     ENDR("insert_scalar_hashtable");
568     }
569 
570 #ifdef UNDEF
double_hashtable_pre091101(b,hf)571     INT double_hashtable_pre091101(b,hf) OP b; INT (*hf)();
572 {
573     INT erg = OK;
574     OP d;
575     CTO(HASHTABLE,"double_hashtable(1)",b);
576     d = CALLOCOBJECT();
577     SWAP(b,d);
578     erg += init_size_hashtable(b,S_V_LI(d)*2);
579     insert_hashtable_hashtable(d,b,NULL,NULL,hf);
580     ENDR("double_hashtable");
581 }
582 #endif
583 
print_stat_hashtable(a)584 INT print_stat_hashtable(a) OP a;
585 /* AK 0602002 */
586 {
587     INT i;
588     printf("entries = %ld size = %ld\n",S_V_II(a,S_V_LI(a)),S_V_LI(a));
589     printf("entires per slot (>1 == collision)\n");
590     for (i=0;i<S_V_LI(a);i++)
591         printf(" %ld ",(EMPTYP(S_V_I(a,i)) ? -S_V_II(a,i) : S_V_LI(S_V_I(a,i)) ) );
592     printf("\n");
593     return OK;
594 }
595 
double_hashtable(b,hf)596 INT double_hashtable(b,hf) OP b; INT (*hf)();
597 {
598     INT erg = OK;
599     INT i,l,j,hh,index,k;
600     OP z;
601     CTO(HASHTABLE,"double_hashtable(1)",b);
602     l = S_V_LI(b);
603     i = S_V_II(b,l);
604     C_O_K(S_V_I(b,l),EMPTY);
605     inc_vector_co(b,l+1);
606     M_I_I(S_V_LI(b)-1,S_V_L(b));
607 
608 
609     M_I_I(i,S_V_I(b,S_V_LI(b)));
610     /* die anzahl der eintraege ist o.k. */
611 
612     for (i=l-1;i>=0;i--)
613         {
614         if (not EMPTYP(S_V_I(b,i)))
615             {
616             z = S_V_I(b,i);
617             for (j=0;j<S_V_LI(z);j++)
618                 if (not EMPTYP(S_V_I(z,j)))
619                     {
620                     /* schauen ob der eintrag in die zweite haelfte muss */
621                     if (hf == hash_monompartition)
622                         hh = HASH_MONOMPARTITION(S_V_I(z,j));
623                     else if (hf == hash)
624 		        hh = HASH(S_V_I(z,j));
625                     else
626                         hh = (*hf)(S_V_I(z,j));
627                     index = hh % S_V_LI(b);
628                     if (index < 0) index += S_V_LI(b);
629                     if (index == i) ;
630                     else if (index == (i+l) )
631                         {
632                         /* muss in die zweite haelfte */
633                         if (EMPTYP(S_V_I(b,index))) {
634                             erg += m_il_v(1,S_V_I(b,index));
635                             SWAP(S_V_I(z,j), S_V_I(S_V_I(b,index),0));
636                             }
637                         else {
638                             inc_vector_co(S_V_I(b,index),1);
639                             SWAP(S_V_I(z,j), S_V_I(S_V_I(b,index),S_V_LI(S_V_I(b,index))-1 ) );
640                             }
641                         }
642                     else
643                         {
644                         erg += error("double_hashtable(i)");
645                         goto ende;
646                         }
647                     }
648             }
649         }
650 ende:
651     /* pointer updaten */
652     k = -1;
653     for (i=S_V_LI(b)-1,z = S_V_I(b,S_V_LI(b)-1) ; i>=l;i--,z--)
654         if (EMPTYP(z)) C_I_I(z,k);
655         else k = i;
656     for (;i>=0;i--,z--)
657         if (EMPTYP(z)) {
658             /* SYMCHECK(S_I_I(z) != -1,"double_hashtable:e2"); */
659             C_I_I(z,k);
660             }
661         else
662             break;
663 
664     CTO(HASHTABLE,"double_hashtable(1-end)",b);
665     ENDR("double_hashtable");
666 }
667 
split_hashtable(a,b,c)668 INT split_hashtable(a,b,c) OP a,b,c;
669 /* AK 201201 */
670 {
671     INT i,t=0,h=0,erg = OK;
672     OP z;
673     CTO(HASHTABLE,"split_hashtable(1)",a);
674     CTO(EMPTY,"split_hashtable(2)",b);
675     CTO(EMPTY,"split_hashtable(3)",c);
676     SYMCHECK(WEIGHT_HASHTABLE(a)<=1, "split_hashtable:<2 entries");
677 
678     m_il_v(S_V_LI(a)+1,b);C_O_K(b,HASHTABLE);M_I_I(S_V_LI(a),S_V_L(b));
679     m_il_v(S_V_LI(a)+1,c);C_O_K(c,HASHTABLE);M_I_I(S_V_LI(a),S_V_L(c));
680     for (i=0;i<S_V_LI(a);i++)
681         {
682         if (not EMPTYP(S_V_I(a,i)))
683            {
684            if (t++%2) COPY(S_V_I(a,i),S_V_I(b,i));
685            else  COPY(S_V_I(a,i),S_V_I(c,i));
686            h = i;
687            }
688         }
689 
690     if (t == 1) /* only entires at one adress, split them */
691         {
692         m_il_v(S_V_LI(S_V_I(c,h)), S_V_I(b,h));
693         for (i=0;i<S_V_LI(S_V_I(c,h));i++)
694             if (i%2) { SWAP(S_V_I(S_V_I(c,h),i), S_V_I(S_V_I(b,h),i) ); }
695         }
696 
697     t = 0; FORALL(z,b, { t++; } ); M_I_I(t,S_V_I(b, S_V_LI(b)));
698     h = 0; FORALL(z,c, { h++; } ); M_I_I(h,S_V_I(c, S_V_LI(c)));
699     SYMCHECK( h+t != WEIGHT_HASHTABLE(a) ,"split_hashtable:weight doesnt add");
700     CTO(HASHTABLE,"split_hashtable(2-res)",b);
701     CTO(HASHTABLE,"split_hashtable(3-res)",c);
702     ENDR("split_hashtable");
703 }
704 
705 
706 
707 
hash_partition(a)708 INT hash_partition(a) OP a;
709 /* AK 261001 */
710 {
711     INT erg = OK,i;
712     CTO(PARTITION,"hash_partition(1)",a);
713     if (S_PA_HASH(a) == -1)  /* no hash value up to now */
714         {
715         i = hash(S_PA_S(a));
716         C_PA_HASH(a,i);
717         return i;
718         }
719     else
720         return S_PA_HASH(a);
721 
722     ENDR("hash_partition");
723 }
724 
hash_monompartition(a)725 INT hash_monompartition(a) OP a;
726 /* AK 261001 */
727 {
728     INT erg = OK,res;
729     CTO(MONOM,"hash_monompartition(1)",a);
730     CTO(PARTITION,"hash_monompartition(1)",S_MO_S(a));
731     if (S_PA_HASH(S_MO_S(a)) == -1)
732         {
733         HASH_INTEGERVECTOR(S_PA_S(S_MO_S(a)),res);
734         C_PA_HASH(S_MO_S(a),res);
735         return res;
736         }
737     else
738         return S_PA_HASH(S_MO_S(a));
739 
740     ENDR("hash_monompartition");
741 }
742 
hash_integervector(a)743 INT hash_integervector(a) OP a;
744 /* AK 261001 */
745 {
746     INT res;
747     HASH_INTEGERVECTOR(a,res);
748     return res;
749 }
750 
hash(a)751 INT hash(a) OP a;
752 /* returns hash-number unsigned 32 bit */
753 /* AK 281097 */
754 {
755     INT i,erg=OK;
756     COP("hash(1)",a);
757     again:
758     switch(S_O_K(a))
759         {
760         case EMPTY:
761             return 0;
762         case INTEGER:
763             return S_I_I(a);
764         case MONOM:
765             a=S_MO_S(a);
766             goto again;
767         case POLYNOM:
768         case LIST:
769             return hash_list(a);
770         case SKEWPARTITION:
771             return hash_skewpartition(a);
772         case PARTITION:
773             return hash_partition(a);
774         case PERMUTATION: a=S_P_S(a);goto again;
775         case SUBSET:
776 	case GALOISRING:
777         case INTEGERVECTOR:
778             return hash_integervector(a);
779 #ifdef FFTRUE
780         case FF:
781             return hash_ff(a);
782 #endif
783         case MATRIX:
784         case INTEGERMATRIX:
785         case KRANZTYPUS:
786             return hash_matrix(a);
787         case VECTOR:
788             {
789             INT res;
790             if (S_V_LI(a) == 0) return 4711; /* AK 300802 4711 instead of 11 */
791             res = hash(S_V_I(a,0));
792             for (i=1;i<S_V_LI(a);i++)
793                 {
794                 res *= 4711;   /* AK 300802 4711 instead of 11 */
795                 res += hash(S_V_I(a,i));
796                 }
797             return res;
798             }
799         default:
800             erg += WTO("hash(1)",a);
801             break;
802         }
803     ENDR("hash");
804 }
805 #define t_HASHTABLE_SF(a,b,af,t,cf,tf)\
806 do {\
807     INT i,j;\
808     OP z;\
809     if (a == b)  { erg += (*af)(a); goto ende; }\
810    \
811     if (WEIGHT_HASHTABLE(a) > 30 ) /* more then 30 entries *//* AK 260901 */\
812          erg += init(BINTREE,b);\
813     else\
814          erg += init(t,b);\
815  \
816     for (i=0;i<S_V_LI(a);i++)\
817     {\
818     z = S_V_I(a,i);\
819     if (not EMPTYP(z))\
820         {\
821         for (j=0;j<S_V_LI(z);j++)\
822         if (not EMPTYP(S_V_I(z,j)))\
823         if (not NULLP(S_MO_K(S_V_I(z,j))))\
824             {\
825             OP d = CALLOCOBJECT();\
826             erg += m_skn_s(S_MO_S(S_V_I(z,j)),\
827                     S_MO_K(S_V_I(z,j)),NULL,d);\
828             INSERT(d,b,NULL,cf);\
829             }\
830         }\
831  \
832     }\
833     if (S_O_K(b) == BINTREE) erg += (*tf)(b,b);\
834 } while(0)
835 
t_HASHTABLE_SCHUR(a,b)836 INT t_HASHTABLE_SCHUR(a,b) OP a,b;
837 /* AK 240901 */
838 {
839     INT erg = OK;
840     CTO(HASHTABLE,"t_HASHTABLE_SCHUR(1)",a);
841     t_HASHTABLE_SF(a,b,t_HASHTABLE_SCHUR_apply,
842                    SCHUR,comp_monomschur,t_BINTREE_SCHUR);
843 ende:
844     CTO(SCHUR,"t_HASHTABLE_SCHUR(e2)",b);
845     ENDR("t_HASHTABLE_SCHUR");
846 }
847 
t_HASHTABLE_MONOMIAL(a,b)848 INT t_HASHTABLE_MONOMIAL(a,b) OP a,b;
849 /* AK 240901 */
850 {
851     INT erg = OK;
852     CTO(HASHTABLE,"t_HASHTABLE_MONOMIAL(1)",a);
853     t_HASHTABLE_SF(a,b,t_HASHTABLE_MONOMIAL_apply,
854                    MONOMIAL,comp_monommonomial,t_BINTREE_MONOMIAL);
855 ende:
856     CTO(MONOMIAL,"t_HASHTABLE_MONOMIAL(e2)",b);
857     ENDR("t_HASHTABLE_MONOMIAL");
858 }
859 
t_HASHTABLE_HOMSYM(a,b)860 INT t_HASHTABLE_HOMSYM(a,b) OP a,b;
861 /* AK 240901 */
862 {
863     INT erg = OK;
864     CTO(HASHTABLE,"t_HASHTABLE_HOMSYM(1)",a);
865     t_HASHTABLE_SF(a,b,t_HASHTABLE_HOMSYM_apply,HOMSYM,
866                    comp_monomhomsym,t_BINTREE_HOMSYM);
867 ende:
868     CTO(HOMSYM,"t_HASHTABLE_HOMSYM(e2)",b);
869     ENDR("t_HASHTABLE_HOMSYM");
870 }
871 
t_HASHTABLE_ELMSYM(a,b)872 INT t_HASHTABLE_ELMSYM(a,b) OP a,b;
873 /* AK 240901 */
874 {
875     INT erg = OK;
876     CTO(HASHTABLE,"t_HASHTABLE_ELMSYM(1)",a);
877     t_HASHTABLE_SF(a,b,t_HASHTABLE_ELMSYM_apply,ELMSYM,
878                    comp_monomelmsym,t_BINTREE_ELMSYM);
879 ende:
880     CTO(ELMSYM,"t_HASHTABLE_ELMSYM(e2)",b);
881     ENDR("t_HASHTABLE_ELMSYM");
882 }
883 
t_HASHTABLE_POWSYM(a,b)884 INT t_HASHTABLE_POWSYM(a,b) OP a,b;
885 /* AK 240901 */
886 {
887     INT erg = OK;
888     CTO(HASHTABLE,"t_HASHTABLE_POWSYM(1)",a);
889     t_HASHTABLE_SF(a,b,t_HASHTABLE_POWSYM_apply,POWSYM,
890                    comp_monompowsym,t_BINTREE_POWSYM);
891 ende:
892     CTO(POWSYM,"t_HASHTABLE_POWSYM(e2)",b);
893     ENDR("t_HASHTABLE_POWSYM");
894 }
895 
t_HASHTABLE_POLYNOM(a,b)896 INT t_HASHTABLE_POLYNOM(a,b) OP a,b;
897 /* AK 240901 */
898 {
899     INT erg = OK;
900     CTO(HASHTABLE,"t_HASHTABLE_POLYNOM(1)",a);
901     t_HASHTABLE_SF(a,b,t_HASHTABLE_POLYNOM_apply,POLYNOM,
902                    comp_monomvector_monomvector,t_BINTREE_POLYNOM);
903 ende:
904     CTO(POLYNOM,"t_HASHTABLE_POLYNOM(e2)",b);
905     ENDR("t_HASHTABLE_POLYNOM");
906 }
907 
908 
909 #define t_HASHTABLE_SF_apply(a,typ,cf,tf)\
910 {\
911     OP b;\
912     INT i,j;\
913     OP z;\
914     b = CALLOCOBJECT();\
915     if (WEIGHT_HASHTABLE(a) > 30 ) /* more then 30 entries *//* AK 260901 */\
916          erg += init_bintree(b);\
917     else\
918          erg += init(typ,b);\
919 \
920     for (i=0;i<S_V_LI(a);i++)\
921     {\
922     z = S_V_I(a,i);\
923     if (not EMPTYP(z))\
924         {\
925         for (j=0;j<S_V_LI(z);j++)\
926         if (not EMPTYP(S_V_I(z,j)))\
927         if (not NULLP(S_MO_K(S_V_I(z,j))))\
928             {\
929             OP d;\
930             d = CALLOCOBJECT();\
931             erg += b_sn_l(CALLOCOBJECT(),NULL,d);\
932             SWAP(S_L_S(d),S_V_I(z,j));\
933             C_O_K(d,typ);\
934             INSERT(d,b,NULL,cf);\
935             }\
936         else {\
937             FREESELF(S_V_I(z,j));\
938             }\
939         }\
940     }\
941 \
942     if (S_O_K(b) == BINTREE)\
943         erg += (*tf)(b,b);\
944 \
945     SWAP(a,b);\
946     M_I_I(0,S_V_I(b,S_V_LI(b))); /* keine eintraege mehr in der hashtable */\
947     FREEALL(b);\
948 }
949 
t_HASHTABLE_POLYNOM_apply(a)950 INT t_HASHTABLE_POLYNOM_apply(a) OP a;
951 /* AK 240901 */
952 {
953     INT erg = OK;
954     CTO(HASHTABLE,"t_HASHTABLE_POLYNOM_apply(1)",a);
955     t_HASHTABLE_SF_apply(a,POLYNOM,comp_monomvector_monomvector,t_BINTREE_POLYNOM);
956     ENDR("t_HASHTABLE_POLYNOM_apply");
957 }
958 
t_HASHTABLE_SCHUR_apply(a)959 INT t_HASHTABLE_SCHUR_apply(a) OP a;
960 /* AK 240901 */
961 {
962     INT erg = OK;
963     CTO(HASHTABLE,"t_HASHTABLE_SCHUR_apply(1)",a);
964     t_HASHTABLE_SF_apply(a,SCHUR,comp_monomschur,t_BINTREE_SCHUR);
965     ENDR("t_HASHTABLE_SCHUR_apply");
966 }
967 
t_HASHTABLE_POWSYM_apply(a)968 INT t_HASHTABLE_POWSYM_apply(a) OP a;
969 /* AK 240901 */
970 {
971     INT erg = OK;
972     CTO(HASHTABLE,"t_HASHTABLE_POWSYM_apply(1)",a);
973     t_HASHTABLE_SF_apply(a,POWSYM,comp_monompowsym,t_BINTREE_POWSYM);
974     ENDR("t_HASHTABLE_POWSYM_apply");
975 }
976 
t_HASHTABLE_HOMSYM_apply(a)977 INT t_HASHTABLE_HOMSYM_apply(a) OP a;
978 /* AK 240901 */
979 {
980     INT erg = OK;
981     CTO(HASHTABLE,"t_HASHTABLE_HOMSYM_apply(1)",a);
982     t_HASHTABLE_SF_apply(a,HOMSYM,comp_monomhomsym,t_BINTREE_HOMSYM);
983     ENDR("t_HASHTABLE_HOMSYM_apply");
984 }
985 
986 
t_HASHTABLE_ELMSYM_apply(a)987 INT t_HASHTABLE_ELMSYM_apply(a) OP a;
988 /* AK 240901 */
989 {
990     INT erg = OK;
991     CTO(HASHTABLE,"t_HASHTABLE_ELMSYM_apply(1)",a);
992     t_HASHTABLE_SF_apply(a,ELMSYM,comp_monomelmsym,t_BINTREE_ELMSYM);
993     ENDR("t_HASHTABLE_ELMSYM_apply");
994 }
995 
996 
997 
t_HASHTABLE_MONOMIAL_apply(a)998 INT t_HASHTABLE_MONOMIAL_apply(a) OP a;
999 /* AK 240901 */
1000 {
1001     INT erg = OK;
1002     CTO(HASHTABLE,"t_HASHTABLE_MONOMIAL_apply(1)",a);
1003     t_HASHTABLE_SF_apply(a,MONOMIAL,comp_monommonomial,t_BINTREE_MONOMIAL);
1004     ENDR("t_HASHTABLE_MONOMIAL_apply");
1005 }
1006 
1007 
t_POWSYM_HASHTABLE(a,b)1008 INT t_POWSYM_HASHTABLE(a,b) OP a,b;
1009 /* AK 171001 */
1010 {
1011     OP z;
1012     INT erg = OK;
1013     CTO(POWSYM,"t_POWSYM_HASHTABLE",a);
1014     CE2(a,b,t_POWSYM_HASHTABLE);
1015     erg += init(HASHTABLE,b);
1016     FORALL(z,a,{ OP d = CALLOCOBJECT();
1017              COPY(z,d);
1018              INSERT_HASHTABLE(d,b,NULL,eq_monomsymfunc,hash_monompartition); } );
1019     ENDR("t_POWSYM_HASHTABLE");
1020 }
1021 
t_HOMSYM_HASHTABLE(a,b)1022 INT t_HOMSYM_HASHTABLE(a,b) OP a,b;
1023 /* AK 171001 */
1024 {
1025     OP z;
1026     INT erg = OK;
1027     CTO(HOMSYM,"t_HOMSYM_HASHTABLE",a);
1028     CE2(a,b,t_HOMSYM_HASHTABLE);
1029     erg += init(HASHTABLE,b);
1030     FORALL(z,a,{ OP d = CALLOCOBJECT();
1031              COPY(z,d);
1032              INSERT_HASHTABLE(d,b,NULL,eq_monomsymfunc,hash_monompartition); } );
1033     ENDR("t_HOMSYM_HASHTABLE");
1034 }
1035 
t_SCHUR_HASHTABLE(a,b)1036 INT t_SCHUR_HASHTABLE(a,b) OP a,b;
1037 /* AK 171001 */
1038 {
1039     OP z;
1040     INT erg = OK;
1041     CTO(SCHUR,"t_SCHUR_HASHTABLE",a);
1042     CE2(a,b,t_SCHUR_HASHTABLE);
1043     erg += init(HASHTABLE,b);
1044     FORALL(z,a,{ OP d = CALLOCOBJECT();
1045              COPY(z,d);
1046              INSERT_HASHTABLE(d,b,NULL,eq_monomsymfunc,hash_monompartition); } );
1047     ENDR("t_SCHUR_HASHTABLE");
1048 }
1049 
1050 
1051 
t_ELMSYM_HASHTABLE(a,b)1052 INT t_ELMSYM_HASHTABLE(a,b) OP a,b;
1053 /* AK 171001 */
1054 {
1055     OP z;
1056     INT erg = OK;
1057     CTO(ELMSYM,"t_ELMSYM_HASHTABLE(1)",a);
1058     CE2(a,b,t_ELMSYM_HASHTABLE);
1059     erg += init(HASHTABLE,b);
1060     FORALL(z,a,{ OP d = CALLOCOBJECT();
1061              COPY(z,d);
1062              INSERT_HASHTABLE(d,b,NULL,eq_monomsymfunc,hash_monompartition); } );
1063     ENDR("t_ELMSYM_HASHTABLE");
1064 }
1065 
1066 
1067 
t_MONOMIAL_HASHTABLE(a,b)1068 INT t_MONOMIAL_HASHTABLE(a,b) OP a,b;
1069 /* AK 171001 */
1070 {
1071     OP z;
1072     INT erg = OK;
1073     CTO(MONOMIAL,"t_MONOMIAL_HASHTABLE(1)",a);
1074     CE2(a,b,t_MONOMIAL_HASHTABLE);
1075     erg += init(HASHTABLE,b);
1076     FORALL(z,a,{
1077              OP d = CALLOCOBJECT();
1078              COPY(z,d);
1079              INSERT_HASHTABLE(d,b,NULL,eq_monomsymfunc,hash_monompartition); } );
1080 
1081     ENDR("t_MONOMIAL_HASHTABLE");
1082 }
1083 
hash2(a)1084 static INT hash2(a) OP a;
1085 {
1086     INT erg = OK;
1087     INT res;
1088     CTO(VECTOR,"hash2(1)",a);
1089     M_I_I(2,S_V_L(a));
1090     res = HASH(a);
1091     M_I_I(3,S_V_L(a));
1092     return res;
1093     ENDR("hash2");
1094 }
hash1(a)1095 static INT hash1(a) OP a;
1096 {
1097     INT erg = OK;
1098     INT res;
1099     CTO(VECTOR,"hash1(1)",a);
1100     SYMCHECK(S_V_LI(a) != 2,"hash1:vector length != 2");
1101     res = HASH(S_V_I(a,0));
1102     return res;
1103     ENDR("hash1");
1104 }
1105 
1106 
eq2(a,b)1107 static INT eq2(a,b) OP a,b;
1108 {
1109     INT erg = OK;
1110     INT res;
1111     CTO(VECTOR,"eq2(1)",a);
1112     CTO(VECTOR,"eq2(2)",b);
1113 
1114     M_I_I(2,S_V_L(a));
1115     M_I_I(2,S_V_L(b));
1116     res = EQ(a,b);
1117     M_I_I(3,S_V_L(a));
1118     M_I_I(3,S_V_L(b));
1119     return res;
1120     ENDR("eq2");
1121 }
1122 
eq1(a,b)1123 static INT eq1(a,b) OP a,b;
1124 {
1125     INT erg = OK;
1126     INT res;
1127     CTO(VECTOR,"eq1(1)",a);
1128 
1129 /*
1130     M_I_I(1,S_V_L(a));
1131     M_I_I(1,S_V_L(b));
1132     res = EQ(a,b);
1133     M_I_I(2,S_V_L(a));
1134     M_I_I(2,S_V_L(b));
1135     return res;
1136 */
1137     return EQ(S_V_I(a,0), S_V_I(b,0));
1138     ENDR("eq1");
1139 }
1140 
1141 
1142 
find_1result_hashtable(a,h)1143 OP find_1result_hashtable(a,h) OP a,h;
1144 {
1145     INT erg = OK;
1146     OP res,v;
1147     CTO(ANYTYPE,"find_1result_hashtable(1)",a);
1148     CTO(HASHTABLE,"find_1result_hashtable(2)",h);
1149 
1150     if (lookup1 == NULL)
1151         NEW_VECTOR(lookup1,2);
1152     C_V_I(lookup1,0,a);
1153     res = find_hashtable(lookup1,h,eq1,hash1);
1154 
1155     if (res == NULL) return res;
1156 
1157     res = S_V_I(res,1);
1158 
1159     return res;
1160 
1161     ENDO("find_1result_hashtable");
1162 }
1163 
find_2result_hashtable(a,b,h)1164 OP find_2result_hashtable(a,b,h) OP a,b,h;
1165 {
1166     INT erg = OK;
1167     OP res,v;
1168     CTO(ANYTYPE,"find_2result_hashtable(1)",a);
1169     CTO(ANYTYPE,"find_2result_hashtable(2)",b);
1170     CTO(HASHTABLE,"find_2result_hashtable(3)",h);
1171 
1172     NEW_VECTOR(v,3);
1173     COPY(a,S_V_I(v,0));
1174     COPY(b,S_V_I(v,1));
1175     res = find_hashtable(v,h,eq2,hash2);
1176     FREEALL(v);
1177     if (res == NULL) return res;
1178 
1179     res = S_V_I(res,2);
1180 
1181     return res;
1182 
1183     ENDO("find_2result_hashtable");
1184 }
1185 
move_2result_hashtable(a,b,c,h)1186 INT move_2result_hashtable(a,b,c,h) OP a,b,c,h;
1187 {
1188     INT erg = OK;
1189     OP v;
1190     CTO(ANYTYPE,"move_2result_hashtable(1)",a);
1191     CTO(ANYTYPE,"move_2result_hashtable(2)",b);
1192     CTO(ANYTYPE,"move_2result_hashtable(3)",c);
1193     CTO(HASHTABLE,"move_2result_hashtable(4)",h);
1194     NEW_VECTOR(v,3);
1195     COPY(a,S_V_I(v,0));
1196     COPY(b,S_V_I(v,1));
1197     C_V_I(v,2,c);
1198     C_O_K(c,EMPTY);
1199     FREEALL(c);
1200     insert_scalar_hashtable(v,h,NULL,eq2,hash2);
1201     CTO(HASHTABLE,"move_2result_hashtable(4-res)",h);
1202     ENDR("move_2result_hashtable");
1203 }
1204 
move_1result_hashtable(a,c,h)1205 INT move_1result_hashtable(a,c,h) OP a,c,h;
1206 {
1207     INT erg = OK;
1208     OP v;
1209     CTO(ANYTYPE,"move_1result_hashtable(1)",a);
1210     CTO(ANYTYPE,"move_1result_hashtable(2)",c);
1211     CTO(HASHTABLE,"move_1result_hashtable(3)",h);
1212     NEW_VECTOR(v,2);
1213     COPY(a,S_V_I(v,0));
1214     C_V_I(v,1,c);
1215     C_O_K(c,EMPTY);
1216     FREEALL(c);
1217     insert_scalar_hashtable(v,h,NULL,eq1,hash1);
1218     CTO(HASHTABLE,"move_1result_hashtable(e3)",h);
1219     ENDR("move_1result_hashtable");
1220 }
1221 
filter_apply_hashtable(a,f)1222 INT filter_apply_hashtable(a,f) OP a; INT (*f)();
1223 /* AK 130603 */
1224 /* if f return true the elemnts stay in the hashtable */
1225 {
1226     OP z;
1227     INT erg = OK;
1228     CTO(HASHTABLE,"filter_apply_hashtable(1)",a);
1229     FORALL(z,a, {
1230         if ((*f)(z) != TRUE)
1231             {
1232             FREESELF(z);
1233             DEC_INTEGER(S_V_I(a,S_V_LI(a))); /* counter-- */
1234             }
1235         });
1236     ENDR("filter_apply_hashtable");
1237 }
1238 
t_HASHTABLE_VECTOR(a,v)1239 INT t_HASHTABLE_VECTOR(a,v) OP a,v;
1240 /* AK 040803 */
1241 {
1242     INT erg =OK;INT i=0;
1243     OP z;
1244     CTO(HASHTABLE,"t_HASHTABLE_VECTOR(1)",a);
1245     CE2(a,v,t_HASHTABLE_VECTOR);
1246     m_il_v(S_V_II(a,S_V_LI(a)),v);
1247     FORALL(z,a,{ COPY(z,S_V_I(v,i)); i++; });
1248     ENDR("t_HASHTABLE_VECTOR");
1249 }
1250