1 /****************************************************************************/
3 /* Chaine de CAO & VLSI AVERTEC */
5 /* Produit : AVERTEC global tools */
6 /* Fichier : mbk_vector.c */
8 /* © copyright 2000 AVERTEC */
9 /* Tous droits reserves */
11 /* Auteur(s) : Antony PINTO */
13 /****************************************************************************/
16 #include "mbk_vector.h"
19 static int MBV_ELT_SIZE
= 0;
20 static AdvancedNameAllocator
*MBV_NAME_ALLOCATOR
= NULL
;
21 static char *MBV_NO_CORRESP
= 0;
23 static inline void addAtIndex(ht
*tbl
, char *key
, char *corresp
, int index
);
24 static inline mbv_tab
*newmbv_tab(ht
*tbl
, char *key
, int left
, int right
);
25 static inline long getElt(mbv_tab
*table
, int index
);
26 static inline void addElt(mbv_tab
*table
, int index
, long elt
);
27 static inline void addName(mbv_tab
*table
, int index
, char *corresp
, int nameallocate
);
28 static inline char *transName(mbv_tab
*table
, int index
, char *buf
);
29 static inline char *getCorresp(ht
*tbl
, mbv_tab
*table
, int index
, char *name
, char *buf
, int del
);
30 static inline void addInHt(ht
*tbl
, char *key
, mbv_tab
*table
);
31 static inline void resize(mbv_tab
*table
, int index
, int dep
);
32 static inline void reverseTbl(mbv_tab
*table
);
34 mbv_tab
*mbv_resize(ht
*tbl
, char *key
, int left
, int right
);
36 /****************************************************************************/
38 /****************************************************************************/
42 /****************************************************************************/
43 static inline void addElt(mbv_tab
*table
, int index
, long elt
)
47 if (MBV_NAME_ALLOCATOR
)
48 table
->TABLE
.NUM
[index
] = (int)elt
;
50 table
->TABLE
.NOM
[index
] = (char*)elt
;
53 /*}}}************************************************************************/
57 /****************************************************************************/
58 static inline void addName(mbv_tab
*table
, int index
, char *corresp
,
62 if (MBV_NAME_ALLOCATOR
)
63 table
->TABLE
.NUM
[index
] = AdvancedNameAlloc(MBV_NAME_ALLOCATOR
,corresp
) + 1;
64 else if (nameallocate
)
65 table
->TABLE
.NOM
[index
] = namealloc(corresp
);
67 table
->TABLE
.NOM
[index
] = corresp
;
70 /*}}}************************************************************************/
74 /****************************************************************************/
75 static inline long getElt(mbv_tab
*table
, int index
)
77 if (MBV_NAME_ALLOCATOR
)
78 return (long)table
->TABLE
.NUM
[index
];
80 return (long)table
->TABLE
.NOM
[index
];
83 /*}}}************************************************************************/
87 /****************************************************************************/
88 static inline void resize(mbv_tab
*table
, int index
, int dep
)
93 if (table
->RIGHT
< index
)
95 olds
= table
->RIGHT
- table
->LEFT
+ 1;
96 table
->RIGHT
= index
+ dep
;
97 size
= table
->RIGHT
- table
->LEFT
+ 1;
98 str
= mbkalloc(MBV_ELT_SIZE
*size
);
99 //memset(str + olds,0,MBV_ELT_SIZE*(size - olds));
100 memset(str
,0,MBV_ELT_SIZE
*size
);
101 memcpy(str
,table
->TABLE
.TAB
,MBV_ELT_SIZE
*olds
);
102 mbkfree(table
->TABLE
.TAB
);
103 table
->TABLE
.TAB
= str
;
105 else if (index
< table
->LEFT
)
107 olds
= table
->RIGHT
- table
->LEFT
+ 1;
108 table
->LEFT
= (index
> dep
) ? index
- dep
: 0;
109 size
= table
->RIGHT
- table
->LEFT
+ 1;
110 str
= mbkalloc(MBV_ELT_SIZE
*size
);
111 memset(str
,0,MBV_ELT_SIZE
*(size
- olds
));
112 //memcpy(str + size - olds,table->TABLE.TAB,MBV_ELT_SIZE*olds);
113 memcpy(str
+ (size
- olds
)*MBV_ELT_SIZE
,table
->TABLE
.TAB
,MBV_ELT_SIZE
*olds
);
114 mbkfree(table
->TABLE
.TAB
);
115 table
->TABLE
.TAB
= str
;
119 /*}}}************************************************************************/
120 /*{{{ reverseTbl() */
123 /****************************************************************************/
124 static inline void reverseTbl(mbv_tab
*table
)
129 size
= table
->RIGHT
- table
->LEFT
+ 1;
131 for (i
= 0; i
< size
; i
++)
133 elt
= getElt(table
,i
);
134 addElt(table
,i
,getElt(table
,(size
-1) - i
));
135 addElt(table
,(size
-1) - i
,elt
);
139 /*}}}************************************************************************/
143 /****************************************************************************/
144 static inline void addInHt(ht
*tbl
, char *key
, mbv_tab
*table
)
146 addhtitem(tbl
,key
,(long)table
);
149 static inline int addInHtIfNew(ht
*tbl
, char *key
, mbv_tab
*table
)
151 if (gethtitem(tbl
,key
)!=EMPTYHT
) return 1;
152 addhtitem(tbl
,key
,(long)table
);
156 /*}}}************************************************************************/
157 /*{{{ newmbv_tab() */
160 /****************************************************************************/
161 static inline mbv_tab
*newmbv_tab(ht
*tbl
, char *key
, int left
, int right
)
167 MBV_ELT_SIZE
= sizeof(char*);
169 size
= right
- left
+ 1;
170 table
= mbkalloc(sizeof(mbv_tab
));
172 table
->RIGHT
= right
;
174 table
->TABLE
.TAB
= mbkalloc(MBV_ELT_SIZE
* size
);
176 memset(table
->TABLE
.TAB
,0,MBV_ELT_SIZE
* size
);
179 addInHt(tbl
,key
,table
);
184 /*}}}************************************************************************/
185 /*{{{ dupmbv_tab() */
188 /****************************************************************************/
189 static inline mbv_tab
*dupmbv_tab(mbv_tab
*table
, char *prefix
)
193 char buf
[1024], buf2
[1024], *corresp
;
195 res
= newmbv_tab(NULL
,NULL
,table
->LEFT
,table
->RIGHT
);
196 size
= table
->RIGHT
- table
->LEFT
+ 1;
198 for (i
= 0; i
< size
; i
++)
199 addElt(res
,i
,getElt(table
,i
));
201 for (i
= 0; i
< size
; i
++)
202 if ((corresp
= transName(table
,i
,buf
)) == MBV_NO_CORRESP
||
204 addName(res
,i
,MBV_NO_CORRESP
,1);
207 sprintf(buf2
,"%s%c%s",prefix
,SEPAR
,corresp
);
208 addName(res
,i
,buf2
,1);
214 /*}}}************************************************************************/
215 /*{{{ addAtIndex() */
218 /****************************************************************************/
219 static inline void addAtIndex(ht
*tbl
, char *key
, char *corresp
, int index
)
223 if (!(table
= mbv_get(tbl
,key
)))
224 table
= newmbv_tab(tbl
,key
,index
,index
);
226 mbv_addAtIndex(table
,corresp
,index
);
229 /*}}}************************************************************************/
233 /****************************************************************************/
234 static inline char *transName(mbv_tab
*table
, int index
, char *buf
)
236 if (MBV_NAME_ALLOCATOR
)
240 if ((name
= table
->TABLE
.NUM
[index
]))
242 AdvancedNameAllocName(MBV_NAME_ALLOCATOR
,name
-1,buf
);
253 if ((name
= table
->TABLE
.NOM
[index
]))
264 /*}}}************************************************************************/
265 /*{{{ getCorresp() */
268 /****************************************************************************/
269 static inline char *getCorresp(ht
*tbl
, mbv_tab
*table
, int index
, char *key
,
276 res
= transName(table
,0,buf
);
282 res
= transName(table
,index
- table
->LEFT
,buf
);
294 /*}}}************************************************************************/
295 /*}}}************************************************************************/
297 /****************************************************************************/
298 /*{{{ mbv_prefix() */
301 /****************************************************************************/
302 void mbv_prefix(ht
*tbl
, char *prefix
)
308 for (i
= 0; i
< tbl
->length
; i
++)
312 if (val
!= EMPTYHT
&& val
!= DELETEHT
)
313 hi
->value
= (long)dupmbv_tab((mbv_tab
*)val
,prefix
);
317 /*}}}************************************************************************/
318 /*{{{ mbv_setNoCorrepondance() */
321 /****************************************************************************/
322 void mbv_setNoCorrepondance(char *noCorrespString
)
324 MBV_NO_CORRESP
= noCorrespString
;
327 /*}}}************************************************************************/
328 ///*{{{ mbv_changeRef() */
331 ///****************************************************************************/
332 //void mbv_changeRef(ht *oht, ht *nht, chain_list *old, chain_list *new)
334 // int nleft, nright, oleft, oright, nm, om;
335 // int size, k, ol, or, nl, nr;
337 // char nname[1024], oname[1024], buf[1024], *nkey, *okey;
338 // mbv_tab *otable, *ntable;
341 // for (; old && new; old = delchain(old,old), new = delchain(new,new))
343 // nm = sscanf(new->DATA,"%s%d:%d",nname,&nleft,&nright);
344 // om = sscanf(old->DATA,"%s%d:%d",oname,&oleft,&oright);
346 // ol = (oleft <= oright) ? oleft : oright;
347 // or = (oleft <= oright) ? oright : oleft;
348 // nl = (nleft <= nright) ? nleft : nright;
349 // nr = (nleft <= nright) ? nright : nleft;
351 // nkey = namealloc(nname);
352 // okey = namealloc(oname);
356 // //&& (otable = mbv_get(oht,okey)))
357 // printf("[BVL_WAR] botched name changing\b");
360 // if ((ntable = mbv_get(nht,nkey )))
361 // mbv_addAtIndex(ntable,transName(otable,0,buf),nleft);
364 // otable->LEFT = nleft;
365 // otable->RIGHT = nleft;
366 // addInHt(nht,nkey ,otable);
367 // delhtitem(oht,old->DATA);
373 // if ((otable = mbv_get(oht,okey )))
378 // ntable = mbv_get(nht,nkey);
379 // if (!ntable && oleft == nleft && oright == nright)
380 // addInHt(nht,nkey ,otable);
381 // else if (!ntable && oleft-oright == nleft-nright)
383 // addInHt(nht,nkey ,otable);
384 // otable->LEFT = nl;
385 // otable->RIGHT = nr;
387 // else if (!ntable && oleft-oright == nright-nleft)
389 // addInHt(nht,nkey ,otable);
390 // otable->LEFT = nl;
391 // otable->RIGHT = nr;
392 // size = or - ol + 1;
394 // for (k = 0; k < size; k ++)
396 // elt = getElt(otable,k);
397 // addElt(otable,k,getElt(otable,(size-1) - k));
398 // addElt(otable,(size-1) - k,elt);
403 // if (!(ntable = mbv_initName(nht,nkey ,nl,nr)))
404 // if (!(ntable = mbv_resize(nht,nkey ,nl,nr)))
407 // size = or - ol + 1;
409 // for (k = 0; k < size; k ++)
410 // if (nleft <= nright && oleft <= oright)
411 // addElt(ntable,k + (nl-ntable->LEFT),getElt(otable,k));
413 // addElt(ntable,(nr-ntable->RIGHT) - k,getElt(otable,k));
415 // mbkfree(otable->TABLE);
420 // addInHt(nht,nkey ,otable);
423 // fprintf(stderr,"[MBV_ERR] Bad number of argument to data\n");
425 // delhtitem(oht,old->DATA);
428 // fprintf(stderr,"[MBV_ERR] Bad old name\n");
436 ht
*mbv_duplicateht(ht
*source
)
442 newht
=addht(source
->count
);
444 cl
=ch
=GetAllHTKeys(source
);
447 key
=(char *)cl
->DATA
;
449 dupmbv_tab(mbv_get(source
,key
), NULL
));
457 ///*}}}************************************************************************/
458 /*{{{ mbv_changeRef() */
461 /****************************************************************************/
463 void mbv_changeRef(ht
*oht
, ht
*nht
, chain_list
*old
, chain_list
*new)
465 int nleft
, nright
, oleft
, oright
, nm
, om
;
466 int size
, k
= 0, ol
, or, nl
, nr
, shift
;
467 char nname
[1024], oname
[1024], buf
[1024], *nkey
, *okey
;
468 mbv_tab
*otable
, *ntable
;
472 for (; old
&& new; old
= delchain(old
,old
), new = delchain(new,new))
474 nm
= sscanf(new->DATA
,"%s%d:%d",nname
,&nleft
,&nright
);
475 om
= sscanf(old
->DATA
,"%s%d:%d",oname
,&oleft
,&oright
);
477 nkey
= namealloc(nname
);
478 okey
= namealloc(oname
);
479 otable
= mbv_get(oht
,okey
);
480 ntable
= mbv_get(nht
,nkey
);
486 if (strncasecmp(okey
,"ext@",4)!=0)
487 avt_error("mbv", 1, AVT_WAR
,"could not find correspondance for name '%s'\n",oname
);
493 mbv_addAtIndex(ntable
,transName(otable
,0,buf
),nleft
);
494 mbkfree(otable
->TABLE
.TAB
);
500 ntable
->LEFT
= nleft
;
501 ntable
->RIGHT
= nleft
;
502 addInHt(nht
,nkey
,ntable
);
507 if (addInHtIfNew(nht
,nkey
,otable
))
509 mbkfree(otable
->TABLE
.TAB
);
515 fprintf(stderr
,"[MBV_WAR] contact support@avertec.com\n");
516 addInHt(nht
,nkey
,otable
);
520 ol
= (oleft
<= oright
) ? oleft
: oright
;
521 or = (oleft
<= oright
) ? oright
: oleft
;
522 nl
= (nleft
<= nright
) ? nleft
: nright
;
523 nr
= (nleft
<= nright
) ? nright
: nleft
;
525 if (or - ol
!= nr
- nl
)
526 fprintf(stderr
,"[MBV_ERR] Botched name\n");
529 // ntable = mbv_get(nht,nkey);
531 if (!ntable
&& oleft
== nleft
&& oright
== nright
)
533 else if (!ntable
&& oleft
-oright
== nleft
-nright
)
539 else if (!ntable
&& oleft
-oright
== nright
-nleft
)
548 // if needed the correspondence table is resized
550 if (!(ntable
&& ntable
->LEFT
<= nl
&& ntable
->RIGHT
>= nr
)
551 && !(ntable
= mbv_initName(nht
,nkey
,nl
,nr
))
552 && !(ntable
= mbv_resize(nht
,nkey
,nl
,nr
)) )
555 size = or - otable->LEFT + 1;
556 shift = nl - ntable->LEFT;
558 for (k
= ol
; k
<= or/* size*/; k
++)
559 if ((elt
= getElt(otable
,k
-otable
->LEFT
)))
560 addElt(ntable
,nl
+(k
-ol
)-ntable
->LEFT
/*k+shift*/,elt
);
562 mbkfree(otable
->TABLE
.TAB
);
565 addInHt(nht
,nkey
,ntable
);
569 fprintf(stderr
,"[MBV_ERR] Bad number of argument to data\n");
573 /*}}}************************************************************************/
574 /*{{{ mbv_useAdvancedNameAllocator() */
577 /****************************************************************************/
578 void mbv_useAdvancedNameAllocator()
582 MBV_ELT_SIZE
= sizeof(int);
583 MBV_NAME_ALLOCATOR
= CreateAdvancedNameAllocator(CASE_SENSITIVE
);
587 /*}}}************************************************************************/
588 /*{{{ mbv_addAtIndex() */
591 /****************************************************************************/
592 void mbv_addAtIndex(mbv_tab
*table
, char *corresp
, int index
)
594 resize(table
,index
,16);
598 index
= index
- table
->LEFT
;
601 addName(table
,index
,corresp
,0);
604 /*}}}************************************************************************/
605 /*{{{ mbv_resize() */
608 /****************************************************************************/
609 mbv_tab
*mbv_resize(ht
*tbl
, char *key
, int left
, int right
)
621 if (!(table
= mbv_get(tbl
,key
)))
623 else if (right
< table
->LEFT
)
625 resize(table
,left
,0);
629 else if (table
->RIGHT
< left
)
631 resize(table
,right
,0);
637 for (tmp
= left
; tmp
<= right
; tmp
++)
638 if (tmp
> table
->RIGHT
|| table
->LEFT
> tmp
)
640 else if (getElt(table
,tmp
- table
->LEFT
))
642 avt_error("mbv", 1, AVT_ERR
, "Conflict on %s(%d to %d) to merge with %s(%d to %d), cannot resize\n", key
, left
, right
, key
, table
->LEFT
, table
->RIGHT
);
643 // fprintf(stderr,"[MBV_ERR] Conflict can not resize\n");
646 resize(table
,left
,0);
647 resize(table
,right
,0);
653 /*}}}************************************************************************/
654 /*{{{ mbv_initName() */
657 /****************************************************************************/
658 mbv_tab
*mbv_initName(ht
*tbl
, char *key
, int left
, int right
)
670 if (!(table
= mbv_get(tbl
,key
)))
671 return newmbv_tab(tbl
,key
,left
,right
);
676 /*}}}************************************************************************/
677 /*{{{ mbv_addCorresp() */
680 /****************************************************************************/
681 int mbv_addCorresp(ht
*tbl
, char *key
, char *corresp
)
683 char buf
[1024], test
;
686 switch (sscanf(key
,"%s %d%c",buf
,&index
,&test
))
691 key
= namealloc(buf
);
692 addAtIndex(tbl
,key
,corresp
,index
);
702 /*}}}************************************************************************/
706 /****************************************************************************/
707 mbv_tab
*mbv_get(ht
*tbl
, char *key
)
711 if ((table
=(mbv_tab
*)gethtitem(tbl
,key
)) == (mbv_tab
*)EMPTYHT
||
712 table
== (mbv_tab
*)DELETEHT
)
718 ht
*mbv_buildglobalht(chain_list
*htl
)
720 ht
*h
=addht(10000), *j
;
725 entries
=GetAllHTKeys(j
);
726 while (entries
!=NULL
)
728 addhtitem(h
, entries
->DATA
, gethtitem(j
, entries
->DATA
));
729 entries
=delchain(entries
, entries
);
735 /*}}}************************************************************************/
736 ///*{{{ mbv_getFromVect() */
739 ///****************************************************************************/
740 //mbv_tab *mbv_getFromVect(ht *tbl, char *key)
745 // sscanf(key,"%s",rad);
746 // if ((table = (mbv_tab*)gethtitem(tbl,namealloc(rad))) == (mbv_tab*)EMPTYHT)
752 ///*}}}************************************************************************/
753 ///*{{{ mbv_addFromVect() */
756 ///****************************************************************************/
757 //void mbv_addFromVect(ht *tbl, char *key, mbv_tab *data)
761 // sscanf(key,"%s",rad);
762 // addhtitem(tbl,namealloc(rad),(long)data);
765 ///*}}}************************************************************************/
769 ///****************************************************************************/
770 //void mbv_del(ht *tbl, char *key)
773 // char buf[1024], test, *res;
776 // switch (sscanf(key,"%s %d%c",buf,&index,&test))
781 // if ((table = mbv_get(tbl,buf)))
784 // res = table->TABLE[0];
786 // res = table->TABLE[index - table->LEFT];
796 ///*}}}************************************************************************/
800 /****************************************************************************/
801 void mbv_free(ht
*tbl
, char *key
)
805 if ((table
= mbv_get(tbl
,key
)))
807 mbkfree(table
->TABLE
.TAB
);
813 void mbv_freeht(ht
*source
)
818 cl
=ch
=GetAllHTKeys(source
);
821 key
=(char *)cl
->DATA
;
822 mbv_free(source
, key
);
829 /*}}}************************************************************************/
830 /*{{{ mbv_getCorresp() */
833 /****************************************************************************/
834 char *mbv_getCorresp(ht
*tbl
, char *key
, char *buf
)
837 char name
[1024], test
, *res
;
840 switch (sscanf(key
,"%s %d%c",name
,&index
,&test
))
845 key
= namealloc(name
);
846 if ((table
= mbv_get(tbl
,key
)))
847 res
= getCorresp(tbl
,table
,index
,key
,buf
,0);
858 /*}}}************************************************************************/
859 /*{{{ mbv_getCorrespAndDel() */
862 /****************************************************************************/
863 char *mbv_getCorrespAndDel(ht
*tbl
, char *key
, char *buf
)
866 char name
[1024], test
, *res
;
869 switch (sscanf(key
,"%s %d%c",name
,&index
,&test
))
874 key
= namealloc(name
);
875 if ((table
= mbv_get(tbl
,key
)))
876 res
= getCorresp(tbl
,table
,index
,key
,buf
,1);
887 /*}}}************************************************************************/
888 /*{{{ mbv_dumpCorresp() */
891 /****************************************************************************/
892 void mbv_dumpCorresp(ht
*table
)
898 char buf
[1024], *name
;
900 for (i
= 0; i
< table
->length
; i
++)
902 hi
= &(table
->pElem
[i
]);
904 if (val
!= EMPTYHT
&& val
!= DELETEHT
)
907 size
= tab
->RIGHT
- tab
->LEFT
+ 1;
908 for (j
= 0; j
< size
; j
++)
910 name
= transName(tab
,j
,buf
);
911 name
= name
? name
: "nothing";
912 printf("%s(%d) -> %s\n", (char*)hi
->key
,j
+tab
->LEFT
,name
);
918 /*}}}************************************************************************/
919 /*}}}************************************************************************/
921 /*{{{ Test functions */
922 /****************************************************************************/
925 /****************************************************************************/
928 /* void mbv_changeRef(ht *orig, ht *dest, chain_list *old, chain_list *new) */
930 /****************************************************************************/
934 ht
*old
[TSIZE
], *new[TSIZE
], *top
;
935 //int mem[] = {1024,3145728};
938 char buf
[TSIZE
], *corresp
[TSIZE
], *oname
[TSIZE
], *nname
;
939 chain_list
*och
, *nch
;
943 for (j
= 0; j
< TSIZE
; j
++)
946 mbv_initName(new[j
],namealloc("mem"),0,TSIZE
-1);
948 sprintf(buf
,"mem_%d",j
);
949 oname
[j
] = mbkstrdup(buf
);
951 for (i
= 0; i
< TSIZE
; i
++)
954 sprintf(buf
,"cell_%d_mem",i
+j
*TSIZE
);
955 corresp
[i
] = mbkstrdup(buf
);
957 mbv_addCorresp(old
[i
],oname
[j
],corresp
[i
]);
959 //printf("drive %d : ",i);
960 //mbv_dumpCorresp(old[i]);
962 for (i
= 0; i
< TSIZE
; i
++)
964 och
= addchain(NULL
,oname
[j
]);
966 sprintf(buf
,"mem %d",i
);
967 nname
= mbkstrdup(buf
);
968 nch
= addchain(NULL
,nname
);
970 mbv_changeRef(old
[i
],new[j
],och
,nch
);
978 sprintf(buf
,"mem %d:%d",0,TSIZE
-1);
979 oname
[0] = mbkstrdup(buf
);
980 och
= addchain(NULL
,oname
[0]);
983 sprintf(buf
,"mem %d:%d",(j
+1)*TSIZE
-1,j
*TSIZE
);
985 sprintf(buf
,"mem %d:%d",j
*TSIZE
,(j
+1)*TSIZE
-1);
986 nname
= mbkstrdup(buf
);
987 nch
= addchain(NULL
,nname
);
989 mbv_changeRef(new[j
],top
,och
,nch
);
991 //mbv_dumpCorresp(new[j]);
994 mbv_dumpCorresp(top
);
996 for (i = 0; i < TSIZE; i ++)
1004 /*}}}************************************************************************/
1007 /* />gcc -o main -L$AVT_DISTRIB_DIR/lib -Xlinker -z -Xlinker allextract \
1008 -lMut325 -lstdc++ -lnsl -ldl -lm -Xlinker -z -Xlinker defaultextract */
1010 /****************************************************************************/
1011 int main(int argc
, char *argv
[])
1013 char *testbench
[] =
1015 "sig0" ,"testsig0" ,
1016 "sig 0" ,"testsig(0)" ,
1017 "sig(0)" ,"testsig(0)" ,
1018 "sig 10" ,"testsig(10)" ,
1019 "sig 58" ,"testsig(58)" ,
1020 "sig 15" ,"testsig(15)" ,
1021 "sig 13" ,"testsig(13)" ,
1022 "sig 45" ,"testsig(45)" ,
1023 "sig1 58" ,"testsig1(58)" ,
1024 "sig1 98" ,"testsig1(98)" ,
1025 "sig1 10" ,"testsig1(10)" ,
1027 // chain_list *old, *new;
1028 char *res
, buf
[1024];
1029 int i
, nbbench
, nberr
= 0;
1030 ht
* tbl
= addht(50);
1034 // mbv_useAdvancedNameAllocator();
1036 nbbench
= (int)(sizeof(testbench
)/sizeof(char*))/2;
1037 for (i
= 0; i
< nbbench
; i
++ )
1038 mbv_addCorresp(tbl
,testbench
[i
*2],testbench
[i
*2+1]);
1040 // mbv_prefix(tbl,"prefix");
1041 for (i
= 0; i
< nbbench
; i
++ )
1043 res
= mbv_getCorresp(tbl
,testbench
[i
*2],buf
);
1047 printf("[MBV_ERR] not found corresp for : %s\n",testbench
[i
*2]);
1049 else if (strcmp(res
,testbench
[i
*2+1]))
1052 printf("[MBV_ERR] expected : %s obtained : %s\n",testbench
[i
*2+1],res
);
1055 printf("[MBV_TEST] %d/%d errors\n",nberr
,nbbench
);
1057 printf("--- testing changeref ---\n\n");
1059 printf("\n--- done ---\n");
1062 return EXIT_SUCCESS
;
1067 /*}}}************************************************************************/