1 /****************************************************************************/
3 /* Chaine de CAO & VLSI Alliance */
5 /* Produit : TTV Version 1 */
6 /* Fichier : ttv_alloc.c */
8 /* (c) copyright 1995-1998 Laboratoire LIP6 equipe ASIM */
9 /* Tous droits reserves */
10 /* Support : e-mail alliance-support@asim.lip6.fr */
12 /* Auteur(s) : Karim DIOURY */
14 /****************************************************************************/
15 /* allocation des structures de la ttvfig */
16 /****************************************************************************/
20 ttvfig_list
*TTV_LIST_TTVFIG
= NULL
;
21 chain_list
*TTV_HEAD_TTVFIG
= NULL
;
22 ptype_list
*TTV_FREE_MEMTTVFIG
= NULL
;
23 ht
*TTV_FREE_MEMTTVFIGHT
= NULL
;
24 ttvsbloc_list
*TTV_FREE_SBLOC
= NULL
;
25 ttvlbloc_list
*TTV_FREE_LBLOC
= NULL
;
26 ttvcritic_list
*TTV_FREE_CRITIC
= NULL
;
27 ttvfind_list
*TTV_FREE_FIND
= NULL
;
28 ttvpath_list
*TTV_FREE_PATH
= NULL
;
29 long TTV_NUMB_SIG
= 0 ;
30 long TTV_MAX_SIG
= TTV_ALLOC_MAX
;
31 long TTV_NUMB_LINE
= 0 ;
32 long TTV_MAX_LINE
= TTV_ALLOC_MAX
;
33 static HeapAlloc
*TTV_FIND_STB_HEAP
=NULL
;
34 static HeapAlloc
*TTV_PATH_STB_HEAP
=NULL
;
36 /*****************************************************************************/
37 /* function ttv_allocttvfig() */
39 /* iname : nom d'instance de la figure ttvfig */
40 /* fname : nom de figure de la ttvfig */
41 /* root : pointeur sur la ttvfig pere si elle existe */
43 /* fonction d'allocation d'une ttvfig et d'initialisation des champs */
44 /*****************************************************************************/
45 ttvfig_list
*ttv_allocttvfig(iname
,fname
,root
)
51 ttvfig_list
*model
= ttv_gethtmodel(fname
) ;
53 ttvfig
= (ttvfig_list
*)mbkalloc(sizeof(ttvfig_list
)) ;
55 ttvfig
->OLD
= TTV_OLD_NEW
;
58 ttv_allocinfottvfig(ttvfig
) ;
59 ttvfig
->INFO
->FIGNAME
= namealloc(fname
) ;
60 ttvfig
->STATUS
= TTV_STS_MODEL
;
61 ttv_addhtmodel(ttvfig
) ;
65 ttvfig
->INFO
= model
->INFO
;
66 ttvfig
->INFO
->INSTANCES
= addchain(ttvfig
->INFO
->INSTANCES
,ttvfig
) ;
67 ttvfig
->STATUS
= (long)0 ;
69 ttvfig
->INSNAME
= ttv_checkfigname(namealloc(iname
)) ;
72 root
->INS
= addchain(root
->INS
,ttvfig
) ;
76 ttvfig
->STATUS
|= TTV_STS_HEAD
;
77 TTV_HEAD_TTVFIG
= addchain(TTV_HEAD_TTVFIG
,ttvfig
) ;
79 ttvfig
->CONSIG
= NULL
;
80 ttvfig
->NBCONSIG
= (long)0 ;
81 ttvfig
->NCSIG
= NULL
;
82 ttvfig
->NBNCSIG
= (long)0 ;
83 ttvfig
->ELCMDSIG
= NULL
;
84 ttvfig
->NBELCMDSIG
= (long)0 ;
85 ttvfig
->ILCMDSIG
= NULL
;
86 ttvfig
->NBILCMDSIG
= (long)0 ;
87 ttvfig
->ELATCHSIG
= NULL
;
88 ttvfig
->NBELATCHSIG
= (long)0 ;
89 ttvfig
->ILATCHSIG
= NULL
;
90 ttvfig
->NBILATCHSIG
= (long)0 ;
91 ttvfig
->EBREAKSIG
= NULL
;
92 ttvfig
->NBEBREAKSIG
= (long)0 ;
93 ttvfig
->IBREAKSIG
= NULL
;
94 ttvfig
->NBIBREAKSIG
= (long)0 ;
95 ttvfig
->EPRESIG
= NULL
;
96 ttvfig
->NBEPRESIG
= (long)0 ;
97 ttvfig
->IPRESIG
= NULL
;
98 ttvfig
->NBIPRESIG
= (long)0 ;
99 ttvfig
->EXTSIG
= NULL
;
100 ttvfig
->NBEXTSIG
= (long)0 ;
101 ttvfig
->INTSIG
= NULL
;
102 ttvfig
->NBINTSIG
= (long)0 ;
103 ttvfig
->ESIG
= NULL
;
104 ttvfig
->NBESIG
= (long)0 ;
105 ttvfig
->ISIG
= NULL
;
106 ttvfig
->NBISIG
= (long)0 ;
108 ttvfig
->PBLOC
= NULL
;
109 ttvfig
->NBPBLOC
= (long)0 ;
110 ttvfig
->JBLOC
= NULL
;
111 ttvfig
->NBJBLOC
= (long)0 ;
112 ttvfig
->TBLOC
= NULL
;
113 ttvfig
->NBTBLOC
= (long)0 ;
114 ttvfig
->FBLOC
= NULL
;
115 ttvfig
->NBFBLOC
= (long)0 ;
116 ttvfig
->EBLOC
= NULL
;
117 ttvfig
->NBEBLOC
= (long)0 ;
118 ttvfig
->DBLOC
= NULL
;
119 ttvfig
->NBDBLOC
= (long)0 ;
120 ttvfig
->DELAY
= NULL
;
121 ttvfig
->USER
= NULL
;
123 ttvfig
->NEXT
= TTV_LIST_TTVFIG
;
124 TTV_LIST_TTVFIG
= ttvfig
;
129 /*****************************************************************************/
130 /* function ttv_allocinfottvfig() */
132 /* ttvfig : information sur une ttvfig */
134 /* ajoute l'info sur une ttvfig */
135 /*****************************************************************************/
136 void ttv_allocinfottvfig(ttvfig
)
137 ttvfig_list
*ttvfig
;
141 info
= (ttvinfo_list
*)mbkalloc(sizeof(ttvinfo_list
)) ;
143 ttvfig
->INFO
= info
;
144 ttvfig
->INFO
->TOOLNAME
= NULL
;
145 ttvfig
->INFO
->TOOLVERSION
= NULL
;
146 ttvfig
->INFO
->TECHNONAME
= NULL
;
147 ttvfig
->INFO
->TECHNOVERSION
= NULL
;
148 ttvfig
->INFO
->TTVYEAR
= 0 ;
149 ttvfig
->INFO
->TTVMONTH
= 0 ;
150 ttvfig
->INFO
->TTVDAY
= 0 ;
151 ttvfig
->INFO
->TTVHOUR
= 0 ;
152 ttvfig
->INFO
->TTVMIN
= 0 ;
153 ttvfig
->INFO
->TTVSEC
= 0 ;
154 ttvfig
->INFO
->SLOPE
= 0 ;
155 ttvfig
->INFO
->CAPAOUT
= 0 ;
156 ttvfig
->INFO
->STHHIGH
= -1.0 ;
157 ttvfig
->INFO
->STHLOW
= -1.0 ;
158 ttvfig
->INFO
->DTH
= -1.0 ;
159 ttvfig
->INFO
->TEMP
= -1000.0 ;
160 ttvfig
->INFO
->TNOM
= -1000.0 ;
161 ttvfig
->INFO
->VDD
= -1.0 ;
162 ttvfig
->INFO
->LEVEL
= (long)0 ;
163 ttvfig
->INFO
->INSTANCES
= NULL
;
164 ttvfig
->INFO
->MODEL
= ttvfig
;
165 ttvfig
->INFO
->USER
= NULL
;
166 ttvfig
->INFO
->FILENAME
= NULL
;
167 ttvfig
->INFO
->DTB_VERSION
= 2;
170 /*****************************************************************************/
171 /* function ttv_lockttvfig() */
173 /* ttvfig : pointeur sur la ttvfig a locker */
175 /* lock une ttvfig */
176 /*****************************************************************************/
177 void ttv_lockttvfig(ttvfig
)
178 ttvfig_list
*ttvfig
;
180 ttvfig
->STATUS
|= TTV_STS_LOCK
;
183 /*****************************************************************************/
184 /* function ttv_unlockttvfig() */
186 /* ttvfig : pointeur sur la ttvfig a delocker */
188 /* lock une ttvfig */
189 /*****************************************************************************/
190 void ttv_unlockttvfig(ttvfig
)
191 ttvfig_list
*ttvfig
;
193 ttvfig
->STATUS
&= ~(TTV_STS_LOCK
) ;
196 /*****************************************************************************/
197 /* function ttv_freettvfig() */
199 /* ttvfig : pointeur sur la ttvfig a supprimer */
201 /* fonction de liberation de la ttvfig. les references et la liste des liens */
202 /* sont supprimees une ttvfig ne peut-etre supprimer que si elle est sommet */
204 /* 1 si la ttvfig est supprimer 0 sinon */
205 /*****************************************************************************/
206 int ttv_freettvfig(ttvfig
)
207 ttvfig_list
*ttvfig
;
214 if(((ttvfig
->STATUS
& (TTV_STS_HEAD
|TTV_STS_LOCK
)) != TTV_STS_HEAD
) || (ttvfig
->ROOT
!= NULL
))
217 if((ptype
= getptype(ttvfig
->USER
,TTV_STS_HTAB_L
)) != NULL
)
219 delht((ht
*)ptype
->DATA
) ;
220 ttvfig
->USER
= delptype(ttvfig
->USER
,TTV_STS_HTAB_L
) ;
223 if((ptype
= getptype(ttvfig
->USER
,TTV_STS_HTAB_S
)) != NULL
)
225 delht((ht
*)ptype
->DATA
) ;
226 ttvfig
->USER
= delptype(ttvfig
->USER
,TTV_STS_HTAB_S
) ;
229 ttv_freefalsepath(ttvfig
) ;
231 if((ttvfig
->STATUS
& TTV_STS_MODEL
) == TTV_STS_MODEL
)
233 if(ttvfig
->INFO
->INSTANCES
!= NULL
)
235 chain
= ttvfig
->INFO
->INSTANCES
;
236 ptaux
= (ttvfig_list
*)chain
->DATA
;
237 ptaux
->STATUS
|= TTV_STS_MODEL
;
238 ttvfig
->STATUS
&= ~(TTV_STS_MODEL
) ;
239 ttv_addhtmodel(ptaux
) ;
240 ptaux
->INFO
->MODEL
= ptaux
;
241 ptaux
->INFO
->INSTANCES
= ptaux
->INFO
->INSTANCES
->NEXT
;
248 ttvfig
->INFO
->INSTANCES
= delchaindata(ttvfig
->INFO
->INSTANCES
,
252 ptaux
= TTV_LIST_TTVFIG
;
253 while((ptaux
!= NULL
) && (ptaux
!= ttvfig
))
256 ptaux
= ptaux
->NEXT
;
260 if(ptaux
== NULL
) return 0;
262 for(chain
= ttvfig
->INS
; chain
!= NULL
; chain
= chain
->NEXT
)
264 ptaux
= (ttvfig_list
*)chain
->DATA
;
265 ptaux
->STATUS
|= TTV_STS_HEAD
;
266 TTV_HEAD_TTVFIG
= addchain(TTV_HEAD_TTVFIG
,ptaux
) ;
272 if(ttvfig
== TTV_LIST_TTVFIG
)
273 TTV_LIST_TTVFIG
= ttvfig
->NEXT
;
275 ptaux
->NEXT
= ttvfig
->NEXT
;
277 ttv_freettvfigmemory(ttvfig
,TTV_STS_D
|TTV_STS_E
|TTV_STS_F
|TTV_STS_T
|
278 TTV_STS_J
|TTV_STS_P
|TTV_STS_S
) ;
279 ttv_freereflist(ttvfig
,ttvfig
->CONSIG
,ttvfig
->NBCONSIG
) ;
280 ttv_freereflist(ttvfig
,ttvfig
->NCSIG
,ttvfig
->NBNCSIG
) ;
281 ttv_freereflist(ttvfig
,ttvfig
->ELCMDSIG
,ttvfig
->NBELCMDSIG
) ;
282 ttv_freereflist(ttvfig
,ttvfig
->ILCMDSIG
,ttvfig
->NBILCMDSIG
) ;
283 ttv_freereflist(ttvfig
,ttvfig
->ELATCHSIG
,ttvfig
->NBELATCHSIG
) ;
284 ttv_freereflist(ttvfig
,ttvfig
->ILATCHSIG
,ttvfig
->NBILATCHSIG
) ;
285 ttv_freereflist(ttvfig
,ttvfig
->EBREAKSIG
,ttvfig
->NBEBREAKSIG
) ;
286 ttv_freereflist(ttvfig
,ttvfig
->IBREAKSIG
,ttvfig
->NBIBREAKSIG
) ;
287 ttv_freereflist(ttvfig
,ttvfig
->EPRESIG
,ttvfig
->NBEPRESIG
) ;
288 ttv_freereflist(ttvfig
,ttvfig
->IPRESIG
,ttvfig
->NBIPRESIG
) ;
289 ttv_freereflist(ttvfig
,ttvfig
->EXTSIG
,ttvfig
->NBEXTSIG
) ;
290 ttv_freereflist(ttvfig
,ttvfig
->INTSIG
,ttvfig
->NBINTSIG
) ;
291 ttv_freereflist(ttvfig
,ttvfig
->ESIG
,ttvfig
->NBESIG
) ;
292 freechain(ttvfig
->INS
) ;
293 freeptype(ttvfig
->USER
) ;
294 if((ttvfig
->STATUS
& TTV_STS_MODEL
) == TTV_STS_MODEL
)
296 ttv_delrcxlofig(ttvfig
) ;
297 ttv_delhtmodel(ttvfig
) ;
298 mbkfree(ttvfig
->INFO
) ;
300 if((ttvfig
->STATUS
& TTV_STS_HEAD
) == TTV_STS_HEAD
)
301 TTV_HEAD_TTVFIG
= delchaindata(TTV_HEAD_TTVFIG
,ttvfig
) ;
302 ttv_freettvfigdelay(ttvfig
) ;
303 ttv_delinfreelist(NULL
,ttvfig
) ;
304 mbkfree((void *)ttvfig
) ;
309 /*****************************************************************************/
310 /* function ttv_freettvfiglist() */
312 /* chainfig : liste a supprimer */
314 /* fonction de liberation de ttvfig. les references et la liste des liens */
315 /* sont supprimees une ttvfig ne peut-etre supprimer que si elle est sommet */
316 /* et que si c'est une figure de plus bas niveau */
318 /* 1 si la ttvfig est supprimer 0 sinon */
319 /*****************************************************************************/
320 int ttv_freettvfiglist(chainfig
)
321 chain_list
*chainfig
;
323 ttvfig_list
*ttvfig
;
325 ttvfig_list
*ptnext
;
328 chain_list
*chainmodel
= NULL
;
331 chain_list
*chainnext
;
332 chain_list
*chainprev
;
334 for(ttvfig
= TTV_LIST_TTVFIG
; ttvfig
!= NULL
; ttvfig
= ttvfig
->NEXT
)
335 ttvfig
->STATUS
&= ~(TTV_STS_MARQUE
) ;
339 for(chain
= chainfig
; chain
!= NULL
; chain
= chain
->NEXT
)
341 ttvfig
= (ttvfig_list
*)chain
->DATA
;
343 if(((ttvfig
->STATUS
& (TTV_STS_HEAD
|TTV_STS_LOCK
)) == TTV_STS_HEAD
) &&
344 (ttvfig
->ROOT
== NULL
) && (ttvfig
->INS
== NULL
))
346 ttvfig
->STATUS
|= TTV_STS_MARQUE
;
348 if((ptype
= getptype(ttvfig
->USER
,TTV_STS_HTAB_L
)) != NULL
)
350 delht((ht
*)ptype
->DATA
) ;
351 ttvfig
->USER
= delptype(ttvfig
->USER
,TTV_STS_HTAB_L
) ;
354 if((ptype
= getptype(ttvfig
->USER
,TTV_STS_HTAB_S
)) != NULL
)
356 delht((ht
*)ptype
->DATA
) ;
357 ttvfig
->USER
= delptype(ttvfig
->USER
,TTV_STS_HTAB_S
) ;
360 ttv_freefalsepath(ttvfig
) ;
362 if((ttvfig
->STATUS
& TTV_STS_MODEL
) == TTV_STS_MODEL
)
364 chainmodel
= addchain(chainmodel
,(void *)ttvfig
) ;
368 chainx
= addchain(chainx
,ttvfig
) ;
375 for(chain
= chainfig
; chain
!= NULL
; chain
= chain
->NEXT
)
377 ttvfig
= (ttvfig_list
*)chain
->DATA
;
378 ttvfig
= ttvfig
->INFO
->MODEL
;
379 if((ttvfig
->STATUS
& TTV_STS_MARQUE
) != TTV_STS_MARQUE
)
380 chainmodel
= addchain(chainmodel
,ttvfig
) ;
383 for(chainx
= chainmodel
; chainx
!= NULL
; chainx
= chainx
->NEXT
)
385 ttvfig
= (ttvfig_list
*)chainx
->DATA
;
386 for(chain
= ttvfig
->INFO
->INSTANCES
; chain
!= NULL
; chain
= chainnext
)
388 chainnext
= chain
->NEXT
;
389 ptaux
= (ttvfig_list
*)chain
->DATA
;
390 if((ptaux
->STATUS
& TTV_STS_MARQUE
) == TTV_STS_MARQUE
)
392 if(chain
== ttvfig
->INFO
->INSTANCES
)
394 ttvfig
->INFO
->INSTANCES
= ttvfig
->INFO
->INSTANCES
->NEXT
;
398 chainprev
->NEXT
= chain
->NEXT
;
408 freechain(chainfig
) ;
410 for(chain
= chainmodel
; chain
!= NULL
; chain
= chain
->NEXT
)
412 ttvfig
= (ttvfig_list
*)chain
->DATA
;
413 if((ttvfig
->STATUS
& TTV_STS_MARQUE
) != TTV_STS_MARQUE
)
415 if(ttvfig
->INFO
->INSTANCES
!= NULL
)
417 chain
= ttvfig
->INFO
->INSTANCES
;
418 ptaux
= (ttvfig_list
*)chain
->DATA
;
419 ptaux
->STATUS
|= TTV_STS_MODEL
;
420 ttvfig
->STATUS
&= ~(TTV_STS_MODEL
) ;
421 ttv_addhtmodel(ptaux
) ;
422 ptaux
->INFO
->MODEL
= ptaux
;
423 ttvfig
->INFO
->INSTANCES
= ttvfig
->INFO
->INSTANCES
->NEXT
;
429 freechain(chainmodel
) ;
431 for(ttvfig
= TTV_LIST_TTVFIG
; ttvfig
!= NULL
; ttvfig
= ptnext
)
433 ptnext
= ttvfig
->NEXT
;
435 if((ttvfig
->STATUS
& TTV_STS_MARQUE
) != TTV_STS_MARQUE
)
441 if(ttvfig
== TTV_LIST_TTVFIG
)
443 TTV_LIST_TTVFIG
= TTV_LIST_TTVFIG
->NEXT
;
447 ptsav
->NEXT
= ttvfig
->NEXT
;
450 ttv_freettvfigmemory(ttvfig
,TTV_STS_D
|TTV_STS_E
|TTV_STS_F
|TTV_STS_T
|
451 TTV_STS_J
|TTV_STS_P
|TTV_STS_S
) ;
452 ttv_freereflist(ttvfig
,ttvfig
->CONSIG
,ttvfig
->NBCONSIG
) ;
453 ttv_freereflist(ttvfig
,ttvfig
->NCSIG
,ttvfig
->NBNCSIG
) ;
454 ttv_freereflist(ttvfig
,ttvfig
->ELCMDSIG
,ttvfig
->NBELCMDSIG
) ;
455 ttv_freereflist(ttvfig
,ttvfig
->ILCMDSIG
,ttvfig
->NBILCMDSIG
) ;
456 ttv_freereflist(ttvfig
,ttvfig
->ELATCHSIG
,ttvfig
->NBELATCHSIG
) ;
457 ttv_freereflist(ttvfig
,ttvfig
->ILATCHSIG
,ttvfig
->NBILATCHSIG
) ;
458 ttv_freereflist(ttvfig
,ttvfig
->EBREAKSIG
,ttvfig
->NBEBREAKSIG
) ;
459 ttv_freereflist(ttvfig
,ttvfig
->IBREAKSIG
,ttvfig
->NBIBREAKSIG
) ;
460 ttv_freereflist(ttvfig
,ttvfig
->EPRESIG
,ttvfig
->NBEPRESIG
) ;
461 ttv_freereflist(ttvfig
,ttvfig
->IPRESIG
,ttvfig
->NBIPRESIG
) ;
462 ttv_freereflist(ttvfig
,ttvfig
->EXTSIG
,ttvfig
->NBEXTSIG
) ;
463 ttv_freereflist(ttvfig
,ttvfig
->INTSIG
,ttvfig
->NBINTSIG
) ;
464 ttv_freereflist(ttvfig
,ttvfig
->ESIG
,ttvfig
->NBESIG
) ;
465 if((ttvfig
->STATUS
& TTV_STS_MODEL
) == TTV_STS_MODEL
)
467 ttv_delhtmodel(ttvfig
) ;
468 ttv_delrcxlofig(ttvfig
) ;
469 if (ttvfig
->INFO
->FILENAME
!=NULL
) mbkfree(ttvfig
->INFO
->FILENAME
);
470 mbkfree(ttvfig
->INFO
) ;
472 if((ttvfig
->STATUS
& TTV_STS_HEAD
) == TTV_STS_HEAD
)
473 TTV_HEAD_TTVFIG
= delchaindata(TTV_HEAD_TTVFIG
,ttvfig
) ;
474 freechain(ttvfig
->INS
) ;
475 freeptype(ttvfig
->USER
) ;
476 ttv_freettvfigdelay(ttvfig
) ;
477 ttv_delinfreelist(NULL
,ttvfig
) ;
478 mbkfree((void *)ttvfig
) ;
481 TTV_NUMB_REFSIG
= ttv_cleansbloclist(TTV_HEAD_REFSIG
,TTV_NUMB_REFSIG
) ;
485 /*****************************************************************************/
486 /* function ttv_freettvfigtree() */
488 /* ttvfig : pointeur sur la ttvfig a supprimer */
490 /* fonction recursive de liberation de la ttvfig et de tous ses fils */
491 /* attention elle ne peut supprimer qu'une ttvfig sommet */
493 /* 1 si la ttvfig est supprimer 0 sinon */
494 /*****************************************************************************/
495 int ttv_freettvfigtree(ttvfig
)
496 ttvfig_list
*ttvfig
;
499 chain_list
*hchain
= NULL
;
504 for(chain
= ttvfig
->INS
; chain
!= NULL
; chain
= chain
->NEXT
)
506 hchain
= addchain(hchain
,chain
->DATA
) ;
509 if(ttv_freettvfig(ttvfig
) == 0)
516 for(chain
= hchain
; chain
!= NULL
; chain
= chain
->NEXT
)
518 ttv_freettvfigtree((ttvfig_list
*)chain
->DATA
) ;
526 /*****************************************************************************/
527 /* function ttv_freeall() */
530 /* supprime toute la ttvfig */
531 /*****************************************************************************/
534 ttvfig_list
*ttvfig
;
536 chain_list
*chainnext
;
538 for(chain
= TTV_HEAD_TTVFIG
; chain
!= NULL
; chain
= chainnext
)
540 chainnext
= chain
->NEXT
;
541 ttvfig
= (ttvfig_list
*)chain
->DATA
;
542 if((ttvfig
->STATUS
& TTV_STS_LOCK
) != TTV_STS_LOCK
)
543 ttv_freeallttvfig(ttvfig
) ;
547 /*****************************************************************************/
548 /* function ttv_freeallttvfig() */
550 /* ttvfig : pointeur sur la ttvfig a supprimer */
552 /* supprime toute la ttvfig et nettoie la liste des noeuds pour la */
553 /* reallocat attention elle ne peut supprimer qu'une ttvfig sommet */
555 /* 1 si la ttvfig est supprimer 0 sinon */
556 /*****************************************************************************/
557 int ttv_freeallttvfig(ttvfig
)
558 ttvfig_list
*ttvfig
;
560 if(ttv_freettvfigtree(ttvfig
) == 0)
563 TTV_NUMB_REFSIG
= ttv_cleansbloclist(TTV_HEAD_REFSIG
,TTV_NUMB_REFSIG
) ;
568 /*****************************************************************************/
569 /* function ttv_allocsbloc() */
571 /* ttvfig : ttvfig ou l'on doit alloue des signaux */
572 /* pthead : pointeur sur la liste des sblocs ou l'on doit ajouter le bloc */
574 /* fonction d'allocation d'un bloc de signaux */
575 /*****************************************************************************/
576 ttvsbloc_list
*ttv_allocsbloc(ttvfig
,pthead
)
577 ttvfig_list
*ttvfig
;
578 ttvsbloc_list
*pthead
;
583 if(TTV_FREE_SBLOC
== NULL
)
585 if(TTV_NUMB_SIG
< TTV_MAX_SIG
)
587 pt
= (ttvsbloc_list
*)mbkalloc(sizeof(ttvsbloc_list
)) ;
588 TTV_FREE_SBLOC
= pt
;
592 else if(ttv_getsbloclist(ttvfig
) == 0)
595 if(TTV_LANG == TTV_LANG_E)
596 ttv_error(50,"signals",TTV_WARNING) ;
598 ttv_error(50,"signaux",TTV_WARNING) ;
600 pt
= (ttvsbloc_list
*)mbkalloc(sizeof(ttvsbloc_list
)) ;
603 TTV_FREE_SBLOC
= pt
;
608 pt
= TTV_FREE_SBLOC
;
609 TTV_FREE_SBLOC
= TTV_FREE_SBLOC
->NEXT
;
612 for(i
= 0 ; i
< TTV_MAX_SBLOC
; i
++)
613 pt
->SIG
[i
].TYPE
= TTV_SIG_F
;
618 /*****************************************************************************/
619 /* function ttv_freesbloclist() */
621 /* ptheah : tete de liste des blocs de signaux */
623 /* fonction de liberation d'une liste de blocs de signaux */
624 /* renvoie 1 si c'est libere 0 sinon */
625 /*****************************************************************************/
626 void ttv_freenodeuserdata(ptype_list
*ptype
)
629 if ((pt
=getptype(ptype
, TTV_NODE_DUALLINE
))!=NULL
) freechain((chain_list
*)pt
->DATA
);
630 if ((pt
=getptype(ptype
, TTV_NODE_DUALPATH
))!=NULL
) freechain((chain_list
*)pt
->DATA
);
632 int ttv_freesbloclist(pthead
)
633 ttvsbloc_list
*pthead
;
636 ttvsbloc_list
*ptsbloc
;
637 ttvsbloc_list
*ptsblocx
;
641 if(pthead
== NULL
) return 0 ;
643 for(ptsbloc
= pthead
; ptsbloc
!= NULL
; ptsbloc
= ptsbloc
->NEXT
)
646 for(i
= 0 ; i
< TTV_MAX_SBLOC
; i
++)
648 ptsig
= ptsbloc
->SIG
+ i
;
650 if((ptsig
->TYPE
& TTV_SIG_F
) == TTV_SIG_F
)
653 if((ptsig
->TYPE
& TTV_SIG_S
) != TTV_SIG_S
)
655 if((ptsig
->TYPE
& TTV_SIG_L
) == TTV_SIG_L
)
657 if((ptype
= getptype(ptsig
->USER
,TTV_SIG_CMD
)) != NULL
)
658 freechain((chain_list
*)ptype
->DATA
) ;
661 if((ptsig
->TYPE
& TTV_SIG_Q
) == TTV_SIG_Q
)
663 if((ptype
= getptype(ptsig
->USER
,TTV_SIG_CMDOLD
)) != NULL
)
664 freechain((chain_list
*)ptype
->DATA
) ;
668 if ((ptype
=getptype(ptsig
->USER
, TTV_SIG_SWING
))!=NULL
)
669 mbkfree(ptype
->DATA
);
670 freeptype(ptsig
->USER
) ;
671 ttv_freenodeuserdata(ptsig
->NODE
[0].USER
);
672 freeptype(ptsig
->NODE
[0].USER
) ;
673 ttv_freenodeuserdata(ptsig
->NODE
[1].USER
);
674 freeptype(ptsig
->NODE
[1].USER
) ;
678 ptsblocx
->NEXT
= TTV_FREE_SBLOC
;
679 TTV_FREE_SBLOC
= pthead
;
684 /*****************************************************************************/
685 /* function ttv_getsbloclist() */
687 /* ttvfig : ttvfig ou l'on veut alloue des noeuds */
689 /* recupere des noeuds des ttvfig en fonction de la position et de l'age */
690 /* renvoie 1 si c'est libere 0 sinon */
691 /*****************************************************************************/
692 int ttv_getsbloclist(ttvfig
)
693 ttvfig_list
*ttvfig
;
695 ttvfig_list
*ttvfigx
;
696 ttvfig_list
*ttvfigf
;
698 chain_list
*chain0
= NULL
;
699 chain_list
*chain1
= NULL
;
700 chain_list
*chain2
= NULL
;
702 ptype_list
*ptypenext
;
703 ptype_list
*ptypesav
= TTV_FREE_MEMTTVFIG
;
705 if(TTV_FREE_MEMTTVFIG
!= NULL
)
707 for(ptype
= TTV_FREE_MEMTTVFIG
; ptype
!= NULL
; ptype
= ptypenext
)
709 ptypenext
= ptype
->NEXT
;
711 if((ptype
->DATA
!= ttvfig
) &&
712 ((ptype
->TYPE
& TTV_STS_S
&
713 ((ttvfig_list
*)ptype
->DATA
)->STATUS
) != 0) &&
714 ((((ttvfig_list
*)ptype
->DATA
)->STATUS
&(TTV_STS_NOT_FREE
|TTV_STS_LOCK
))
717 ttv_freettvfigmemory((ttvfig_list
*)ptype
->DATA
,
718 ptype
->TYPE
& ~(TTV_STS_T
|TTV_STS_P
|TTV_STS_J
|
719 TTV_STS_D
|TTV_STS_F
|TTV_STS_E
)) ;
720 ptype
->TYPE
&= ~(TTV_STS_S
) ;
724 ttv_delinfreelist(ptypesav
,(ttvfig_list
*)ptype
->DATA
) ;
726 if(TTV_FREE_SBLOC
!= NULL
)
732 ttv_cleantagttvfig(TTV_STS_FREE_0
| TTV_STS_FREE_1
| TTV_STS_FREE_2
) ;
733 ttv_tagttvfigfree(ttvfig
,NULL
,NULL
,TTV_STS_FREE_2
) ;
735 for(ttvfigx
= ttvfig
; ttvfigx
!= NULL
; ttvfigx
= ttvfigx
->ROOT
)
737 ttv_tagttvfigfree(ttvfigx
,NULL
,NULL
,TTV_STS_FREE_1
) ;
740 for(ttvfigx
= TTV_LIST_TTVFIG
; ttvfigx
!= NULL
; ttvfigx
= ttvfigx
->NEXT
)
742 if((ttvfigx
->STATUS
& TTV_STS_HEAD
) == TTV_STS_HEAD
)
743 ttv_tagttvfigfree(ttvfigx
,NULL
,NULL
,TTV_STS_FREE_0
) ;
746 for(ttvfigx
= TTV_LIST_TTVFIG
; ttvfigx
!= NULL
; ttvfigx
= ttvfigx
->NEXT
)
748 if(((ttvfigx
->INS
== NULL
) || (ttvfigx
== ttvfig
->ROOT
)) &&
749 ((ttvfigx
->STATUS
& TTV_STS_MARQUE
) != TTV_STS_MARQUE
))
753 freelevel
= ttvfigx
->STATUS
& TTV_STS_FREE_MASK
;
756 case TTV_STS_FREE_0
: ttvfigf
= ttvfigx
;
757 while((ttvfigf
->NBISIG
== 0) ||
758 ((ttvfigf
->STATUS
& TTV_STS_LOCK
) != 0))
760 ttvfigf
= ttvfigf
->ROOT
;
764 if((ttvfigf
!= NULL
) && (ttvfigf
!= ttvfig
) &&
765 ((ttvfigf
->STATUS
& TTV_STS_MARQUE
)
766 != TTV_STS_MARQUE
) &&
767 ((ttvfigf
->STATUS
& TTV_STS_FREE_MASK
)
770 ttvfigf
->STATUS
|= TTV_STS_MARQUE
;
771 chain0
= addchain(chain0
,(void*)ttvfigf
) ;
774 case TTV_STS_FREE_1
: if(chain0
!= NULL
)
778 for(chain
= chain1
; chain
!= NULL
;
780 ((ttvfig_list
*)chain
->DATA
)->STATUS
&=
788 while((ttvfigf
->NBISIG
== 0) ||
789 ((ttvfigf
->STATUS
& TTV_STS_LOCK
) != 0))
791 ttvfigf
= ttvfigf
->ROOT
;
795 if((ttvfigf
!= NULL
) && (ttvfigf
!= ttvfig
) &&
796 ((ttvfigf
->STATUS
& TTV_STS_MARQUE
)
797 != TTV_STS_MARQUE
) &&
798 ((ttvfigf
->STATUS
& TTV_STS_FREE_MASK
)
801 ttvfigf
->STATUS
|= TTV_STS_MARQUE
;
802 chain1
= addchain(chain1
,(void*)ttvfigf
) ;
805 case TTV_STS_FREE_2
: if((chain0
!= NULL
) || (chain1
!= NULL
))
809 for(chain
= chain2
; chain
!= NULL
;
811 ((ttvfig_list
*)chain
->DATA
)->STATUS
&=
819 while((ttvfigf
->NBISIG
== 0) ||
820 ((ttvfigf
->STATUS
& TTV_STS_LOCK
) != 0))
822 ttvfigf
= ttvfigf
->ROOT
;
826 if((ttvfigf
!= NULL
) && (ttvfigf
!= ttvfig
) &&
827 ((ttvfigf
->STATUS
& TTV_STS_MARQUE
)
828 != TTV_STS_MARQUE
) &&
829 ((ttvfigf
->STATUS
& TTV_STS_FREE_MASK
)
832 ttvfigf
->STATUS
|= TTV_STS_MARQUE
;
833 chain2
= addchain(chain2
,(void*)ttvfigf
) ;
845 for(chain
= chain1
; chain
!= NULL
; chain
= chain
->NEXT
)
846 ((ttvfig_list
*)chain
->DATA
)->STATUS
&= ~(TTV_STS_MARQUE
) ;
847 for(chain
= chain2
; chain
!= NULL
; chain
= chain
->NEXT
)
848 ((ttvfig_list
*)chain
->DATA
)->STATUS
&= ~(TTV_STS_MARQUE
) ;
857 for(chain
= chain2
; chain
!= NULL
; chain
= chain
->NEXT
)
858 ((ttvfig_list
*)chain
->DATA
)->STATUS
&= ~(TTV_STS_MARQUE
) ;
861 else chain0
= chain2
;
866 ttvfigf
= (ttvfig_list
*)chain0
->DATA
;
867 ttvfigf
->STATUS
&= ~(TTV_STS_MARQUE
) ;
868 chain
= chain0
->NEXT
;
869 for(; chain
!= NULL
; chain
= chain
->NEXT
)
871 ttvfigx
= (ttvfig_list
*)chain
->DATA
;
872 ttvfigx
->STATUS
&= ~(TTV_STS_MARQUE
) ;
873 if(((ttvfigf
->STATUS
& (TTV_STS_E
|TTV_STS_F
)) != 0) &&
874 ((ttvfigx
->STATUS
& (TTV_STS_E
|TTV_STS_F
)) == 0))
879 if((((ttvfigx
->STATUS
& (TTV_STS_E
|TTV_STS_F
)) != 0) &&
880 ((ttvfigf
->STATUS
& (TTV_STS_E
|TTV_STS_F
)) == 0)) ||
881 (ttvfigf
->OLD
< ttvfigx
->OLD
))
883 if( (ttvfigf
->OLD
= ttvfigf
->OLD
) )
885 if(ttvfigf
->NBISIG
>= ttvfigf
->NBISIG
)
893 if((ttvfigf
!= ttvfig
) && (ttvfigf
!= NULL
))
895 if((ttvfigf
->STATUS
& (TTV_STS_E
|TTV_STS_F
)) != 0)
897 ttv_freettvfigmemory(ttvfigf
,TTV_STS_F
|TTV_STS_E
) ;
899 ttv_freettvfigmemory(ttvfigf
,TTV_STS_S
) ;
900 ttv_cleantagttvfig(TTV_STS_FREE_0
| TTV_STS_FREE_1
| TTV_STS_FREE_2
) ;
905 ttv_cleantagttvfig(TTV_STS_FREE_0
| TTV_STS_FREE_1
| TTV_STS_FREE_2
) ;
910 /*****************************************************************************/
911 /* function ttv_cleansbloclist() */
913 /* ptheah : tete de liste des blocs de signaux */
915 /* fonction de nettoyage d'une liste de blocs de signaux */
916 /* renvoie le nouveau nombre de signaux de la liste */
917 /*****************************************************************************/
918 long ttv_cleansbloclist(pthead
,nb
)
919 ttvsbloc_list
*pthead
;
923 ttvsbloc_list
*ptsbloc
;
924 ttvsbloc_list
*ptsblocx
= NULL
;
925 ttvsbloc_list
*ptsblocsav
;
930 if((pthead
== NULL
) || (nb
== (long)0))
933 if(pthead
->NEXT
== NULL
) return(nb
) ;
934 ptsblocsav
= pthead
;
936 for(ptsbloc
= pthead
->NEXT
; ptsbloc
!= NULL
; ptsbloc
= ptsbloc
->NEXT
)
938 for(i
= 0 ; i
< TTV_MAX_SBLOC
; i
++)
940 ptsig
= ptsbloc
->SIG
+ i
;
941 if((ptsig
->TYPE
& TTV_SIG_F
) != TTV_SIG_F
) break ;
943 if(i
== TTV_MAX_SBLOC
)
945 ptsblocsav
->NEXT
= ptsbloc
->NEXT
;
946 nb
-= TTV_MAX_SBLOC
;
947 ptsbloc
->NEXT
= ptsblocx
;
949 ptsbloc
= ptsblocsav
;
953 ptsblocsav
= ptsblocsav
->NEXT
;
959 for(ptsbloc
= ptsblocx
; ptsbloc
!= NULL
; ptsbloc
= ptsbloc
->NEXT
)
961 for(i
= 0 ; i
< TTV_MAX_SBLOC
; i
++)
963 (ptsbloc
->SIG
+ i
)->TYPE
&= ~(TTV_SIG_F
) ;
966 chainx
= TTV_FREE_REFSIG
;
967 chain
= TTV_FREE_REFSIG
;
970 ptsig
= (ttvsig_list
*)chain
->DATA
;
971 if((ptsig
->TYPE
& TTV_SIG_F
) != TTV_SIG_F
)
973 if(chain
== TTV_FREE_REFSIG
)
975 TTV_FREE_REFSIG
= delchain(TTV_FREE_REFSIG
,chain
) ;
976 chainx
= TTV_FREE_REFSIG
;
981 chainx
->NEXT
= delchain(chainx
->NEXT
,chain
) ;
982 chain
= chainx
->NEXT
;
987 if(chain
!= TTV_FREE_REFSIG
)
988 chainx
= chainx
->NEXT
;
989 chain
= chain
->NEXT
;
992 for(ptsbloc
= ptsblocx
; ptsbloc
!= NULL
; ptsbloc
= ptsbloc
->NEXT
)
994 for(i
= 0 ; i
< TTV_MAX_SBLOC
; i
++)
996 (ptsbloc
->SIG
+ i
)->TYPE
|= TTV_SIG_F
;
999 ttv_freesbloclist(ptsblocx
) ;
1005 /*****************************************************************************/
1006 /* function ttv_alloclbloc() */
1008 /* ttvfig : ttvfig ou l'on doit alloue des liens */
1009 /* pthead : pointeur sur la liste des lblocs ou l'on doit ajouter le bloc */
1011 /* fonction d'allocation d'un bloc de liens */
1012 /*****************************************************************************/
1013 ttvlbloc_list
*ttv_alloclbloc(ttvfig
,pthead
,type
)
1014 ttvfig_list
*ttvfig
;
1015 ttvlbloc_list
*pthead
;
1021 if(TTV_FREE_LBLOC
== NULL
)
1023 if(TTV_NUMB_LINE
< TTV_MAX_LINE
)
1025 pt
= (ttvlbloc_list
*)mbkalloc(sizeof(ttvlbloc_list
)) ;
1027 TTV_FREE_LBLOC
= pt
;
1030 else if(ttv_getlbloclist(ttvfig
,type
) == 0)
1033 if(TTV_LANG == TTV_LANG_E)
1034 ttv_error(50,"paths",TTV_WARNING) ;
1036 ttv_error(50,"chemins",TTV_WARNING) ;
1038 pt
= (ttvlbloc_list
*)mbkalloc(sizeof(ttvlbloc_list
)) ;
1041 TTV_FREE_LBLOC
= pt
;
1046 pt
= TTV_FREE_LBLOC
;
1047 TTV_FREE_LBLOC
= TTV_FREE_LBLOC
->NEXT
;
1050 for(i
= 0 ; i
< TTV_MAX_LBLOC
; i
++)
1051 pt
->LINE
[i
].TYPE
= TTV_LINE_FR
;
1056 /*****************************************************************************/
1057 /* function ttv_freelbloclist() */
1059 /* ptheah : tete de liste des blocs de liens */
1061 /* fonction de liberation d'une liste de blocs de liens */
1062 /* renvoie 1 si c'est libere 0 sinon */
1063 /*****************************************************************************/
1064 int ttv_freelbloclist(pthead
)
1065 ttvlbloc_list
*pthead
;
1067 ttvline_list
*ptline
;
1068 ttvline_list
*ptlinex
;
1069 ttvline_list
*ptlinsav
;
1070 ttvlbloc_list
*ptlbloc
;
1071 ttvlbloc_list
*ptlblocx
;
1074 if(pthead
== NULL
) return 0 ;
1076 for(ptlbloc
= pthead
; ptlbloc
!= NULL
; ptlbloc
= ptlbloc
->NEXT
)
1078 ptlblocx
= ptlbloc
;
1079 for(i
= 0 ; i
< TTV_MAX_LBLOC
; i
++)
1081 ptline
= ptlbloc
->LINE
+ i
;
1083 if((ptline
->TYPE
& TTV_LINE_FR
) == TTV_LINE_FR
)
1086 if((ptline
->TYPE
& TTV_LINE_PREV
) == TTV_LINE_PREV
)
1088 for(ptlinex
= ptline
->NEXT
; ptlinex
!= NULL
;
1089 ptlinex
= ptlinex
->NEXT
)
1091 if((ptlinex
->TYPE
& TTV_LINE_PREV
) == TTV_LINE_PREV
)
1094 ptlinsav
= (ttvline_list
*)getptype(ptline
->USER
,
1095 TTV_LINE_PREVLINE
)->DATA
;
1096 ptlinsav
->NEXT
= ptlinex
;
1099 getptype(ptlinex
->USER
,TTV_LINE_PREVLINE
)->DATA
= (void *)ptlinsav
;
1102 else if((ptline
->TYPE
& TTV_LINE_ROOT
) == TTV_LINE_ROOT
)
1104 for(ptlinex
= ptline
; ptlinex
!= NULL
; ptlinex
= ptlinex
->NEXT
)
1106 if((ptlinex
->TYPE
& TTV_LINE_PREV
) == TTV_LINE_PREV
)
1110 if(ptline
->ROOT
->INLINE
== ptline
)
1111 ptline
->ROOT
->INLINE
= ptlinex
;
1112 else if(ptline
->ROOT
->INPATH
== ptline
)
1113 ptline
->ROOT
->INPATH
= ptlinex
;
1117 ttv_delprevline(ptlinex
) ;
1118 ptlinex
->TYPE
|= TTV_LINE_ROOT
;
1122 freeptype(ptline
->USER
) ;
1126 ptlblocx
->NEXT
= TTV_FREE_LBLOC
;
1127 TTV_FREE_LBLOC
= pthead
;
1132 /*****************************************************************************/
1133 /* function ttv_getlbloclist() */
1135 /* ttvfig : ttvfig ou l'on veut alloue des liens */
1137 /* recupere des liens des ttvfig en fonction de la position et de l'age */
1138 /* renvoie 1 si c'est libere 0 sinon */
1139 /*****************************************************************************/
1140 int ttv_getlbloclist(ttvfig
,type
)
1141 ttvfig_list
*ttvfig
;
1144 ttvfig_list
*ttvfigx
;
1145 ttvfig_list
*ttvfigf
;
1146 ttvfig_list
*ttvfigff
;
1148 chain_list
*chain0
= NULL
;
1149 chain_list
*chain1
= NULL
;
1150 chain_list
*chain2
= NULL
;
1151 chain_list
*chain3
= NULL
;
1153 ptype_list
*ptypenext
;
1154 ptype_list
*ptypesav
= TTV_FREE_MEMTTVFIG
;
1157 if(TTV_FREE_MEMTTVFIG
!= NULL
)
1159 for(ptype
= TTV_FREE_MEMTTVFIG
; ptype
!= NULL
; ptype
= ptype
= ptypenext
)
1161 ptypenext
= ptype
->NEXT
;
1163 if((ptype
->DATA
!= ttvfig
) &&
1164 ((ptype
->TYPE
& (TTV_STS_T
|TTV_STS_P
|TTV_STS_J
|
1165 TTV_STS_D
|TTV_STS_F
|TTV_STS_E
) &
1166 ((ttvfig_list
*)ptype
->DATA
)->STATUS
) != 0) &&
1167 ((((ttvfig_list
*)ptype
->DATA
)->STATUS
&(TTV_STS_NOT_FREE
|TTV_STS_LOCK
))
1170 ttv_freettvfigmemory((ttvfig_list
*)ptype
->DATA
,
1171 ptype
->TYPE
& ~(TTV_STS_S
)) ;
1172 ptype
->TYPE
&= ~(ptype
->TYPE
& ~(TTV_STS_S
)) ;
1175 if(ptype
->TYPE
== 0)
1176 ttv_delinfreelist(ptypesav
,(ttvfig_list
*)ptype
->DATA
) ;
1178 if(TTV_FREE_LBLOC
!= NULL
)
1184 ttv_cleantagttvfig(TTV_STS_FREE_0
| TTV_STS_FREE_1
| TTV_STS_FREE_2
) ;
1185 ttv_tagttvfigfree(ttvfig
,NULL
,NULL
,TTV_STS_FREE_2
) ;
1187 for(ttvfigx
= ttvfig
; ttvfigx
!= NULL
; ttvfigx
= ttvfigx
->ROOT
)
1189 ttv_tagttvfigfree(ttvfigx
,NULL
,NULL
,TTV_STS_FREE_1
) ;
1192 for(ttvfigx
= TTV_LIST_TTVFIG
; ttvfigx
!= NULL
; ttvfigx
= ttvfigx
->NEXT
)
1194 if((ttvfigx
->STATUS
& TTV_STS_HEAD
) == TTV_STS_HEAD
)
1195 ttv_tagttvfigfree(ttvfigx
,NULL
,NULL
,TTV_STS_FREE_0
) ;
1198 for(ttvfigx
= TTV_LIST_TTVFIG
; ttvfigx
!= NULL
; ttvfigx
= ttvfigx
->NEXT
)
1200 if(((ttvfigx
->INS
== NULL
) || (ttvfigx
== ttvfig
->ROOT
)) &&
1201 ((ttvfigx
->STATUS
& TTV_STS_MARQUE
) != TTV_STS_MARQUE
))
1205 freelevel
= ttvfigx
->STATUS
& TTV_STS_FREE_MASK
;
1208 case TTV_STS_FREE_0
: ttvfigf
= ttvfigx
;
1209 while(((ttvfigf
->NBTBLOC
== 0) &&
1210 (ttvfigf
->NBJBLOC
== 0) &&
1211 (ttvfigf
->NBPBLOC
== 0) &&
1212 (ttvfigf
->NBEBLOC
== 0) &&
1213 (ttvfigf
->NBFBLOC
== 0) &&
1214 (ttvfigf
->NBDBLOC
== 0)) ||
1215 ((ttvfigf
->STATUS
& TTV_STS_LOCK
) != 0))
1217 ttvfigf
= ttvfigf
->ROOT
;
1221 ttvfigff
= ttvfigf
;
1223 while(((((type
& (TTV_LINE_T
| TTV_LINE_J
|
1224 TTV_LINE_P
)) != 0) &&
1225 (ttvfigff
->NBEBLOC
== 0) &&
1226 (ttvfigff
->NBFBLOC
== 0) &&
1227 (ttvfigff
->NBDBLOC
== 0)) ||
1228 (((type
& (TTV_LINE_D
| TTV_LINE_E
|
1229 TTV_LINE_F
)) != 0) &&
1230 (ttvfigff
->NBTBLOC
== 0) &&
1231 (ttvfigff
->NBJBLOC
== 0) &&
1232 (ttvfigff
->NBPBLOC
== 0))) ||
1233 ((ttvfigff
->STATUS
& TTV_STS_LOCK
) != 0))
1235 ttvfigff
= ttvfigff
->ROOT
;
1236 if(ttvfigff
== NULL
)
1239 if(ttvfigff
!= NULL
) ttvfigf
= ttvfigff
;
1240 else if(ttvfigf
== ttvfig
) ttvfigf
= NULL
;
1241 if((ttvfigf
!= NULL
) &&
1242 ((ttvfigf
->STATUS
& TTV_STS_MARQUE
)
1243 != TTV_STS_MARQUE
) &&
1244 ((ttvfigf
->STATUS
& TTV_STS_FREE_MASK
)
1247 ttvfigf
->STATUS
|= TTV_STS_MARQUE
;
1248 chain0
= addchain(chain0
,(void*)ttvfigf
) ;
1251 case TTV_STS_FREE_1
: if(chain0
!= NULL
)
1255 for(chain
= chain1
; chain
!= NULL
;
1256 chain
= chain
->NEXT
)
1257 ((ttvfig_list
*)chain
->DATA
)->STATUS
&=
1265 while(((ttvfigf
->NBTBLOC
== 0) &&
1266 (ttvfigf
->NBJBLOC
== 0) &&
1267 (ttvfigf
->NBPBLOC
== 0) &&
1268 (ttvfigf
->NBEBLOC
== 0) &&
1269 (ttvfigf
->NBFBLOC
== 0) &&
1270 (ttvfigf
->NBDBLOC
== 0)) ||
1271 ((ttvfigf
->STATUS
& TTV_STS_LOCK
) != 0))
1274 ttvfigf
= ttvfigf
->ROOT
;
1278 ttvfigff
= ttvfigf
;
1280 while(((((type
& (TTV_LINE_T
| TTV_LINE_J
|
1281 TTV_LINE_P
)) != 0) &&
1282 (ttvfigff
->NBEBLOC
== 0) &&
1283 (ttvfigff
->NBFBLOC
== 0) &&
1284 (ttvfigff
->NBDBLOC
== 0)) ||
1285 (((type
& (TTV_LINE_D
| TTV_LINE_E
|
1286 TTV_LINE_F
)) != 0) &&
1287 (ttvfigff
->NBTBLOC
== 0) &&
1288 (ttvfigff
->NBJBLOC
== 0) &&
1289 (ttvfigff
->NBPBLOC
== 0))) ||
1290 ((ttvfigff
->STATUS
& TTV_STS_LOCK
) != 0))
1292 ttvfigff
= ttvfigff
->ROOT
;
1293 if(ttvfigff
== NULL
)
1296 if(ttvfigff
!= NULL
) ttvfigf
= ttvfigff
;
1297 else if(ttvfigf
== ttvfig
) ttvfigf
= NULL
;
1298 if((ttvfigf
!= NULL
) &&
1299 ((ttvfigf
->STATUS
& TTV_STS_MARQUE
)
1300 != TTV_STS_MARQUE
) &&
1301 ((ttvfigf
->STATUS
& TTV_STS_FREE_MASK
)
1304 ttvfigf
->STATUS
|= TTV_STS_MARQUE
;
1305 chain1
= addchain(chain1
,(void*)ttvfigf
) ;
1308 case TTV_STS_FREE_2
: if((chain0
!= NULL
) || (chain1
!= NULL
))
1312 for(chain
= chain2
; chain
!= NULL
;
1313 chain
= chain
->NEXT
)
1314 ((ttvfig_list
*)chain
->DATA
)->STATUS
&=
1322 while(((ttvfigf
->NBTBLOC
== 0) &&
1323 (ttvfigf
->NBJBLOC
== 0) &&
1324 (ttvfigf
->NBPBLOC
== 0) &&
1325 (ttvfigf
->NBEBLOC
== 0) &&
1326 (ttvfigf
->NBFBLOC
== 0) &&
1327 (ttvfigf
->NBDBLOC
== 0)) ||
1328 ((ttvfigf
->STATUS
& TTV_STS_LOCK
) != 0))
1330 ttvfigf
= ttvfigf
->ROOT
;
1334 ttvfigff
= ttvfigf
;
1336 while(((((type
& (TTV_LINE_T
| TTV_LINE_J
|
1337 TTV_LINE_P
)) != 0) &&
1338 (ttvfigff
->NBEBLOC
== 0) &&
1339 (ttvfigff
->NBFBLOC
== 0) &&
1340 (ttvfigff
->NBDBLOC
== 0)) ||
1341 (((type
& (TTV_LINE_D
| TTV_LINE_E
|
1342 TTV_LINE_F
)) != 0) &&
1343 (ttvfigff
->NBTBLOC
== 0) &&
1344 (ttvfigff
->NBJBLOC
== 0) &&
1345 (ttvfigff
->NBPBLOC
== 0))) ||
1346 ((ttvfigff
->STATUS
& TTV_STS_LOCK
) != 0))
1348 ttvfigff
= ttvfigff
->ROOT
;
1349 if(ttvfigff
== NULL
)
1352 if(ttvfigff
!= NULL
) ttvfigf
= ttvfigff
;
1353 else if(ttvfigf
== ttvfig
) ttvfigf
= NULL
;
1354 if((ttvfigf
!= NULL
) &&
1355 ((ttvfigf
->STATUS
& TTV_STS_MARQUE
)
1356 != TTV_STS_MARQUE
) &&
1357 ((ttvfigf
->STATUS
& TTV_STS_FREE_MASK
)
1360 ttvfigf
->STATUS
|= TTV_STS_MARQUE
;
1361 chain2
= addchain(chain2
,(void*)ttvfigf
) ;
1364 case TTV_STS_NOT_FREE
: if((chain0
!= NULL
) || (chain1
!= NULL
) ||
1369 for(chain
= chain3
; chain
!= NULL
;
1370 chain
= chain
->NEXT
)
1371 ((ttvfig_list
*)chain
->DATA
)->STATUS
&=
1379 while(((ttvfigf
->NBTBLOC
== 0) &&
1380 (ttvfigf
->NBJBLOC
== 0) &&
1381 (ttvfigf
->NBPBLOC
== 0) &&
1382 (ttvfigf
->NBEBLOC
== 0) &&
1383 (ttvfigf
->NBFBLOC
== 0) &&
1384 (ttvfigf
->NBDBLOC
== 0)) ||
1385 ((ttvfigf
->STATUS
& TTV_STS_LOCK
) != 0))
1387 ttvfigf
= ttvfigf
->ROOT
;
1391 ttvfigff
= ttvfigf
;
1393 while(((((type
& (TTV_LINE_T
| TTV_LINE_J
|
1394 TTV_LINE_P
)) != 0) &&
1395 (ttvfigff
->NBEBLOC
== 0) &&
1396 (ttvfigff
->NBFBLOC
== 0) &&
1397 (ttvfigff
->NBDBLOC
== 0)) ||
1398 (((type
& (TTV_LINE_D
| TTV_LINE_E
|
1399 TTV_LINE_F
)) != 0) &&
1400 (ttvfigff
->NBTBLOC
== 0) &&
1401 (ttvfigff
->NBJBLOC
== 0) &&
1402 (ttvfigff
->NBPBLOC
== 0))) ||
1403 ((ttvfigff
->STATUS
& TTV_STS_LOCK
) != 0))
1405 ttvfigff
= ttvfigff
->ROOT
;
1406 if(ttvfigff
== NULL
)
1409 if(ttvfigff
!= NULL
) ttvfigf
= ttvfigff
;
1410 else if(ttvfigf
== ttvfig
) ttvfigf
= NULL
;
1411 if((ttvfigf
!= NULL
) &&
1412 ((ttvfigf
->STATUS
& TTV_STS_MARQUE
)
1413 != TTV_STS_MARQUE
) &&
1414 ((ttvfigf
->STATUS
& TTV_STS_FREE_MASK
)
1415 == TTV_STS_NOT_FREE
))
1417 ttvfigf
->STATUS
|= TTV_STS_MARQUE
;
1418 chain3
= addchain(chain3
,(void*)ttvfigf
) ;
1429 for(chain
= chain1
; chain
!= NULL
; chain
= chain
->NEXT
)
1430 ((ttvfig_list
*)chain
->DATA
)->STATUS
&= ~(TTV_STS_MARQUE
) ;
1431 for(chain
= chain2
; chain
!= NULL
; chain
= chain
->NEXT
)
1432 ((ttvfig_list
*)chain
->DATA
)->STATUS
&= ~(TTV_STS_MARQUE
) ;
1433 for(chain
= chain3
; chain
!= NULL
; chain
= chain
->NEXT
)
1434 ((ttvfig_list
*)chain
->DATA
)->STATUS
&= ~(TTV_STS_MARQUE
) ;
1444 for(chain
= chain2
; chain
!= NULL
; chain
= chain
->NEXT
)
1445 ((ttvfig_list
*)chain
->DATA
)->STATUS
&= ~(TTV_STS_MARQUE
) ;
1446 for(chain
= chain3
; chain
!= NULL
; chain
= chain
->NEXT
)
1447 ((ttvfig_list
*)chain
->DATA
)->STATUS
&= ~(TTV_STS_MARQUE
) ;
1456 for(chain
= chain3
; chain
!= NULL
; chain
= chain
->NEXT
)
1457 ((ttvfig_list
*)chain
->DATA
)->STATUS
&= ~(TTV_STS_MARQUE
) ;
1460 else chain0
= chain3
;
1466 ttvfigf
= (ttvfig_list
*)chain0
->DATA
;
1467 ttvfigf
->STATUS
&= ~(TTV_STS_MARQUE
) ;
1468 chain
= chain0
->NEXT
;
1469 for(; chain
!= NULL
; chain
= chain
->NEXT
)
1471 ttvfigx
= (ttvfig_list
*)chain
->DATA
;
1472 ttvfigx
->STATUS
&= ~(TTV_STS_MARQUE
) ;
1473 if((type
& (TTV_LINE_T
| TTV_LINE_P
| TTV_LINE_J
)) != 0)
1475 if(((ttvfigf
->NBDBLOC
== 0) && (ttvfigf
->NBEBLOC
== 0) &&
1476 (ttvfigf
->NBFBLOC
== 0)) &&
1477 ((ttvfigx
->NBDBLOC
!= 0) || (ttvfigx
->NBEBLOC
!= 0) ||
1478 (ttvfigx
->NBFBLOC
!= 0)))
1483 else if(((ttvfigf
->NBDBLOC
!= 0) || (ttvfigf
->NBEBLOC
!= 0) ||
1484 (ttvfigf
->NBFBLOC
!= 0)) &&
1485 ((ttvfigx
->NBDBLOC
== 0) && (ttvfigx
->NBEBLOC
== 0) &&
1486 (ttvfigx
->NBFBLOC
== 0)))
1493 if(((ttvfigf
->NBTBLOC
== 0) && (ttvfigf
->NBJBLOC
== 0) &&
1494 (ttvfigf
->NBPBLOC
== 0)) &&
1495 ((ttvfigx
->NBTBLOC
!= 0) || (ttvfigx
->NBJBLOC
!= 0) ||
1496 (ttvfigx
->NBPBLOC
!= 0)))
1501 else if(((ttvfigf
->NBTBLOC
!= 0) || (ttvfigf
->NBJBLOC
!= 0) ||
1502 (ttvfigf
->NBPBLOC
!= 0)) &&
1503 ((ttvfigx
->NBTBLOC
== 0) && (ttvfigx
->NBJBLOC
== 0) &&
1504 (ttvfigx
->NBPBLOC
== 0)))
1510 if(ttvfigf
->OLD
< ttvfigx
->OLD
)
1519 if((((type
& (TTV_LINE_T
| TTV_LINE_J
| TTV_LINE_P
)) != 0) &&
1520 ((ttvfigf
->NBEBLOC
!= 0) || (ttvfigf
->NBDBLOC
!= 0) ||
1521 (ttvfigf
->NBFBLOC
!= 0))) ||
1522 ((ttvfigf
->NBTBLOC
== 0) && (ttvfigf
->NBJBLOC
== 0) &&
1523 (ttvfigf
->NBPBLOC
== 0) &&
1524 ((ttvfigf
->STATUS
& TTV_STS_NOT_FREE
) != TTV_STS_NOT_FREE
)))
1526 if(((ttvfigf
->STATUS
& TTV_STS_D
) == TTV_STS_D
) &&
1527 (ttvfigf
->NBDBLOC
!= 0))
1529 ttv_freettvfigmemory(ttvfigf
,TTV_STS_D
) ;
1531 else if(((ttvfigf
->STATUS
& TTV_STS_F
) == TTV_STS_F
) &&
1532 (ttvfigf
->NBFBLOC
!= 0))
1534 ttv_freettvfigmemory(ttvfigf
,TTV_STS_F
) ;
1536 else if(((ttvfigf
->STATUS
& TTV_STS_E
) == TTV_STS_E
) &&
1537 (ttvfigf
->NBEBLOC
!= 0))
1539 ttv_freettvfigmemory(ttvfigf
,TTV_STS_E
) ;
1541 ttv_cleantagttvfig(TTV_STS_FREE_0
| TTV_STS_FREE_1
| TTV_STS_FREE_2
) ;
1544 else if((((type
& (TTV_LINE_D
| TTV_LINE_E
| TTV_LINE_F
)) != 0) &&
1545 ((ttvfigf
->NBTBLOC
!= 0) || (ttvfigf
->NBJBLOC
!= 0) ||
1546 (ttvfigf
->NBPBLOC
!= 0))) ||
1547 ((ttvfigf
->NBEBLOC
== 0) && (ttvfigf
->NBDBLOC
== 0) &&
1548 (ttvfigf
->NBFBLOC
== 0) &&
1549 ((ttvfigf
->STATUS
& TTV_STS_NOT_FREE
) != TTV_STS_NOT_FREE
)))
1551 if(((ttvfigf
->STATUS
& TTV_STS_T
) == TTV_STS_T
) &&
1552 (ttvfigf
->NBTBLOC
!= 0))
1554 ttv_freettvfigmemory(ttvfigf
,TTV_STS_T
) ;
1556 else if(((ttvfigf
->STATUS
& TTV_STS_P
) == TTV_STS_P
) &&
1557 (ttvfigf
->NBPBLOC
!= 0))
1559 ttv_freettvfigmemory(ttvfigf
,TTV_STS_P
) ;
1561 else if(((ttvfigf
->STATUS
& TTV_STS_J
) == TTV_STS_J
) &&
1562 (ttvfigf
->NBJBLOC
!= 0))
1564 ttv_freettvfigmemory(ttvfigf
,TTV_STS_J
) ;
1566 ttv_cleantagttvfig(TTV_STS_FREE_0
| TTV_STS_FREE_1
| TTV_STS_FREE_2
) ;
1571 ttv_cleantagttvfig(TTV_STS_FREE_0
| TTV_STS_FREE_1
| TTV_STS_FREE_2
) ;
1577 ttv_cleantagttvfig(TTV_STS_FREE_0
| TTV_STS_FREE_1
| TTV_STS_FREE_2
) ;
1582 /*****************************************************************************/
1583 /* function ttv_allocpath() */
1585 /* headpath : liste des chemin */
1586 /* ttvfig : ttvfig du chemin */
1587 /* root : noeud extremite du chemin */
1588 /* node : noeud origine du chemin */
1589 /* type : type de recherche */
1593 /* rajoue un chemin a la liste des chemins */
1594 /*****************************************************************************/
1595 static ttvpath_list
*ttv_getnewpath()
1599 #ifndef MORE_NOHEAPALLOC
1600 if (TTV_FREE_PATH
== NULL
)
1602 pt
= (ttvpath_list
*)mbkalloc(TTV_MAX_BLOC
* sizeof(ttvpath_list
));
1604 for (i
= 1 ; i
< TTV_MAX_BLOC
; i
++)
1613 TTV_FREE_PATH
= TTV_FREE_PATH
->NEXT
;
1615 pt
=mbkalloc(sizeof(ttvpath_list
));
1620 ttvpath_list
*ttv_allocpath(headpath
,ttvfig
,root
,node
,cmd
,latch
,cmdlatch
,latchlist
,data
,access
,refaccess
,type
,delay
,slope
,newdelay
,newslope
,start
,starts
,md
,mf
,crossmin
,phase
,clockpathdelay
)
1621 ttvpath_list
*headpath
;
1622 ttvfig_list
*ttvfig
;
1623 ttvevent_list
*root
;
1624 ttvevent_list
*node
;
1625 ttvevent_list
*cmd
;
1626 ttvevent_list
*latch
;
1627 ttvevent_list
*cmdlatch
;
1628 ptype_list
*latchlist
;
1643 long clockpathdelay
;
1647 pt
=ttv_getnewpath();
1654 pt
->CMDLATCH
= cmdlatch
;
1655 pt
->LATCHLIST
= latchlist
;
1657 pt
->ACCESS
= access
;
1658 pt
->DATADELAY
= data
;
1659 pt
->REFACCESS
= refaccess
;
1661 pt
->DELAY
= newdelay
;
1662 pt
->SLOPE
= newslope
;
1663 pt
->REFDELAY
= delay
;
1664 pt
->REFSLOPE
= slope
;
1665 pt
->DELAYSTART
= start
;
1666 pt
->SLOPESTART
= starts
;
1667 pt
->NEXT
= headpath
;
1670 pt
->CROSSMINDELAY
= crossmin
;
1672 pt
->TTV_MORE_SEARCH_OPTIONS
=0;
1674 pt
->CLOCKPATHDELAY
=clockpathdelay
;
1679 /*****************************************************************************/
1680 /* function ttv_freepathlist() */
1682 /* pthead : liste des noeuds du detail du chemin a liberer */
1684 /* fonction de liberation d'un detail de chemin */
1685 /* renvoie 1 si c'est libere 0 sinon */
1686 /*****************************************************************************/
1687 int ttv_freepathlist(pthead
)
1688 ttvpath_list
*pthead
;
1690 ttvpath_list
*pt
, *npt
;
1691 if(pthead
== NULL
) return 0 ;
1692 for(pt
=pthead
;pt
;pt
=npt
)
1696 ttv_freecriticlist(pt
->CRITIC
) ;
1699 stm_mod_destroy(pt
->MD
);
1704 stm_mod_destroy(pt
->MF
);
1707 if(pt
->LATCHLIST
!= NULL
)
1708 freeptype(pt
->LATCHLIST
) ;
1709 freeptype(pt
->USER
);
1710 #ifdef MORE_NOHEAPALLOC
1714 #ifndef MORE_NOHEAPALLOC
1715 TTV_FREE_PATH
= (ttvpath_list
*)append((chain_list
*)pthead
,
1716 (chain_list
*)TTV_FREE_PATH
);
1721 /*****************************************************************************/
1722 /* function ttv_allocfind() */
1725 /* ajoute un element à la recherche */
1726 /*****************************************************************************/
1728 void ttv_initfindstb(ttvfind_stb_stuff
*sfs
)
1730 sfs
->CROSSDELAY
= sfs
->NOMORECROSSDELAY
= TTV_NOTIME
;
1731 sfs
->IDEAL_CROSSDELAY
= sfs
->IDEAL_NOMORECROSSDELAY
= TTV_NOTIME
;
1732 sfs
->CROSSDELAY_MIN
= TTV_NOTIME
;
1733 sfs
->PHASE
= sfs
->STARTPHASE
= TTV_NO_PHASE
;
1734 sfs
->PERIOD_CHANGE
=0;
1739 ttvfind_stb_stuff
*ttv_allocfindstb()
1741 ttvfind_stb_stuff
*sfs
;
1742 if (TTV_FIND_STB_HEAP
==NULL
)
1744 TTV_FIND_STB_HEAP
=(HeapAlloc
*)mbkalloc(sizeof(HeapAlloc
));
1745 CreateHeap(sizeof(ttvfind_stb_stuff
), TTV_MAX_BLOC
, TTV_FIND_STB_HEAP
);
1747 sfs
=(ttvfind_stb_stuff
*)AddHeapItem(TTV_FIND_STB_HEAP
);
1748 ttv_initfindstb(sfs
);
1752 void ttv_freefindstblist(ttvfind_stb_stuff
*head
)
1754 ttvfind_stb_stuff
*next
;
1755 if (TTV_FIND_STB_HEAP
!=NULL
)
1760 DelHeapItem(TTV_FIND_STB_HEAP
, head
);
1766 ttvpath_stb_stuff
*ttv_allocpath_stb_stuff()
1768 ttvpath_stb_stuff
*sfs
;
1769 if (TTV_PATH_STB_HEAP
==NULL
)
1771 TTV_PATH_STB_HEAP
=(HeapAlloc
*)mbkalloc(sizeof(HeapAlloc
));
1772 CreateHeap(sizeof(ttvpath_stb_stuff
), TTV_MAX_BLOC
, TTV_PATH_STB_HEAP
);
1774 sfs
=(ttvpath_stb_stuff
*)AddHeapItem(TTV_PATH_STB_HEAP
);
1777 void ttv_freepathstblist(ttvpath_stb_stuff
*head
)
1779 ttvpath_stb_stuff
*next
;
1780 if (TTV_PATH_STB_HEAP
!=NULL
)
1785 DelHeapItem(TTV_PATH_STB_HEAP
, head
);
1792 ttvfind_list
*ttv_allocfind(node
)
1793 ttvevent_list
*node
;
1798 if (TTV_FREE_FIND
== NULL
)
1800 pt
= (ttvfind_list
*)mbkalloc(TTV_MAX_BLOC
* sizeof(ttvfind_list
));
1802 for (i
= 1 ; i
< TTV_MAX_BLOC
; i
++)
1811 TTV_FREE_FIND
= TTV_FREE_FIND
->NEXT
;
1813 pt
->NEXT
= node
->FIND
;
1815 pt
->TYPE
= (long)0 ;
1816 pt
->DELAY
= TTV_NOTIME
;
1817 pt
->OUTLINE
= NULL
;
1820 pt
->ORGPHASE
= TTV_NO_PHASE
;
1822 pt
->THRU_FILTER
= 0 ;
1829 /*****************************************************************************/
1830 /* function ttv_freefindlist() */
1832 /* pthead : liste des find a liberer */
1834 /* renvoie 1 si c'est libere 0 sinon */
1835 /*****************************************************************************/
1836 int ttv_freefindlist(pthead
)
1837 ttvfind_list
*pthead
;
1839 ttvfind_list
*pt
, *last
;
1841 if(pthead
== NULL
) return 0 ;
1843 for(pt
= pthead
; pt
!= NULL
; last
=pt
, pt
= pt
->NEXT
)
1844 ttv_freefindstblist(pt
->STB
);
1846 last
->NEXT
= TTV_FREE_FIND
;
1847 TTV_FREE_FIND
= pthead
;
1852 /*****************************************************************************/
1853 /* function ttv_alloccritic() */
1855 /* headcritic : liste des noeuds du detail du chemin */
1856 /* ttvfigh : ttvfig courante */
1857 /* ttvfig : ttvfig du delai elementaire */
1858 /* node : noeud a rajouter au detail du chemin */
1859 /* type : type de recherche */
1863 /* ajoute un element noeud au detail d'un chemin */
1864 /*****************************************************************************/
1865 static ttvcritic_list
*ttv_getnewcritic()
1867 ttvcritic_list
*pt
;
1869 #ifndef MORE_NOHEAPALLOC
1870 if (TTV_FREE_CRITIC
== NULL
)
1872 pt
= (ttvcritic_list
*)mbkalloc(TTV_MAX_BLOC
* sizeof(ttvcritic_list
));
1873 TTV_FREE_CRITIC
= pt
;
1874 for (i
= 1 ; i
< TTV_MAX_BLOC
; i
++)
1882 pt
= TTV_FREE_CRITIC
;
1883 TTV_FREE_CRITIC
= TTV_FREE_CRITIC
->NEXT
;
1885 pt
=(ttvcritic_list
*)mbkalloc(sizeof(ttvcritic_list
));
1890 ttvcritic_list
*ttv_alloccritic(ttvcritic_list
*headcritic
,ttvfig_list
*ttvfigh
,ttvfig_list
*ttvfig
,ttvevent_list
*node
,long type
,long data
,long delay
,long slope
,long newdelay
,long newslope
, char nodeflags
, char *linemodelname
, ttvline_list
*line
)
1892 ttvcritic_list
*pt
;
1893 char bufname
[1024] ;
1897 pt
=ttv_getnewcritic();
1899 if (getptype(node
->ROOT
->USER
, TTV_SIG_CLOCK
)!=NULL
)
1900 pt
->NODE_FLAG
=TTV_NODE_FLAG_ISCLOCK
;
1904 if (!(TTV_MORE_SEARCH_OPTIONS
& TTV_MORE_OPTIONS_SIMPLE_CRITIC
))
1906 if (node
->ROOT
->ROOT
->ROOT
==NULL
)
1908 pt
->NAME
= node
->ROOT
->NAME
;
1909 pt
->NETNAME
= node
->ROOT
->NETNAME
;
1910 pt
->NODE_FLAG
|=TTV_NODE_FLAG_NOALLOC
;
1914 ttv_getsigname(ttvfigh
,bufname
,node
->ROOT
) ;
1915 name
= mbkalloc(strlen(bufname
) + 1) ;
1917 pt
->NAME
= strcpy(name
,bufname
) ;
1919 ttv_getnetname(ttvfigh
,bufname
,node
->ROOT
) ;
1920 name
= mbkalloc(strlen(bufname
) + 1) ;
1922 pt
->NETNAME
= strcpy(name
,bufname
) ;
1926 pt
->NAME
=pt
->NETNAME
=NULL
;
1930 pt
->SIGTYPE
= node
->ROOT
->TYPE
;
1931 pt
->DATADELAY
= data
;
1932 pt
->DELAY
= newdelay
;
1933 pt
->SLOPE
= newslope
;
1934 pt
->REFDELAY
= delay
;
1935 pt
->REFSLOPE
= slope
;
1937 pt
->NEXT
= headcritic
;
1938 pt
->NODE
=node
; // beware, use only in stb
1939 pt
->LINEMODELNAME
=linemodelname
;
1942 if (!(TTV_MORE_SEARCH_OPTIONS
& TTV_MORE_OPTIONS_SIMPLE_CRITIC
))
1944 pt
->SIMDELAY
= TTV_NOTIME
;
1945 pt
->SIMSLOPE
= TTV_NOSLOPE
;
1946 pt
->MODNAME
= NULL
;
1947 pt
->INSNAME
= NULL
;
1948 pt
->CAPA
= ttv_get_signal_capa(node
->ROOT
) ;
1949 if ((node
->ROOT
->TYPE
& TTV_SIG_CO
)==TTV_SIG_CO
1950 || (node
->ROOT
->TYPE
& TTV_SIG_CZ
)==TTV_SIG_CZ
1951 || (node
->ROOT
->TYPE
& TTV_SIG_CB
)==TTV_SIG_CB
1952 || (node
->ROOT
->TYPE
& TTV_SIG_CT
)==TTV_SIG_CT
1953 || (node
->ROOT
->TYPE
& TTV_SIG_N
)==TTV_SIG_N
1955 pt
->OUTPUT_CAPA
=ttv_get_signal_output_capacitance(ttvfigh
, node
->ROOT
);
1959 pt
->CAPA
+= pt
->OUTPUT_CAPA
;
1961 if((node
->TYPE
& TTV_NODE_UP
) == TTV_NODE_UP
)
1963 pt
->SNODE
= TTV_UP
;
1964 pt
->PNODE
= node
->ROOT
->PNODE
[1];
1968 pt
->SNODE
= TTV_DOWN
;
1969 pt
->PNODE
= node
->ROOT
->PNODE
[0];
1973 pt
->NODE_FLAG
|=nodeflags
;
1975 pt
->PROP
=ttv_testsigflag(node
->ROOT
, 0xffffffff);
1981 /*****************************************************************************/
1982 /* function ttv_freecriticlist() */
1984 /* pthead : liste des noeuds du detail du chemin a liberer */
1986 /* fonction de liberation d'un detail de chemin */
1987 /* renvoie 1 si c'est libere 0 sinon */
1988 /*****************************************************************************/
1989 int ttv_freecriticlist(pthead
)
1990 ttvcritic_list
*pthead
;
1992 ttvcritic_list
*pt
, *next
;
1994 if(pthead
== NULL
) return 0 ;
1996 for(pt
= pthead
; pt
->NEXT
!= NULL
; pt
= next
)
1999 freeptype(pt
->USER
);
2000 if ((pt
->NODE_FLAG
& TTV_NODE_FLAG_NOALLOC
)==0)
2002 if (pt
->NAME
!=NULL
) mbkfree((void*)pt
->NAME
) ;
2003 if (pt
->NETNAME
!=NULL
) mbkfree((void*)pt
->NETNAME
) ;
2005 #ifdef MORE_NOHEAPALLOC
2010 freeptype(pt
->USER
);
2011 if ((pt
->NODE_FLAG
& TTV_NODE_FLAG_NOALLOC
)==0)
2013 if (pt
->NAME
!=NULL
) mbkfree((void*)pt
->NAME
) ;
2014 if (pt
->NETNAME
!=NULL
) mbkfree((void*)pt
->NETNAME
) ;
2016 #ifdef MORE_NOHEAPALLOC
2019 pt
->NEXT
= TTV_FREE_CRITIC
;
2020 TTV_FREE_CRITIC
= pthead
;
2026 /*****************************************************************************/
2027 /* function ttv_allocreflist() */
2029 /* chain : chaine de signaux a referencer */
2030 /* nb : nombre de signaux a referencer */
2032 /* cree un tableau de signaux a referencer */
2033 /*****************************************************************************/
2034 ttvsig_list
**ttv_allocreflist(chain
,nb
)
2040 chain_list
*chainx
;
2042 if((chain
== NULL
) || (nb
== 0L)) return(NULL
);
2044 pt
= (ttvsig_list
**)mbkalloc(nb
* sizeof(ttvsig_list
*));
2048 for (i
= nb
-1 ; i
>= 0 ; i
--)
2050 *(pt
+ i
) = (ttvsig_list
*)chainx
->DATA
;
2051 chainx
= chainx
->NEXT
;
2059 /*****************************************************************************/
2060 /* function ttv_freereflist() */
2062 /* ttvfig : ttvfig du liberer */
2063 /* pthead : tableau a liberer */
2064 /* nb : taille tableau */
2066 /* libere un tableau de signaux reference */
2067 /* si nb = 0 ou ttvfig = NULL ne libere pas les signaux */
2068 /* renvoie 1 si c'est libere 0 sinon */
2069 /*****************************************************************************/
2070 int ttv_freereflist(ttvfig
,pthead
,nb
)
2071 ttvfig_list
*ttvfig
;
2072 ttvsig_list
**pthead
;
2075 ttvsig_list
*ptsig
;
2078 if(pthead
== NULL
) return 0 ;
2081 if((ttvfig
->ROOT
== NULL
) && ((ttvfig
->STATUS
& TTV_STS_HEAD
) == TTV_STS_HEAD
))
2082 for(i
= 0 ; i
< nb
; i
++)
2084 ptsig
= *(pthead
+ i
) ;
2085 ttv_delsiglevel(ttvfig
,ptsig
) ;
2086 if(ptsig
->ROOT
== ttvfig
)
2088 if(((ptsig
->TYPE
& (TTV_SIG_L
|TTV_SIG_R
|TTV_SIG_Q
|TTV_SIG_B
)) == 0) ||
2089 ((pthead
!= ttvfig
->CONSIG
) && (pthead
!= ttvfig
->NCSIG
)) ||
2090 (((ptsig
->TYPE
& TTV_SIG_Q
) == TTV_SIG_Q
) &&
2091 (ttvfig
->ILCMDSIG
== NULL
) && (ttvfig
->ELCMDSIG
== NULL
)) ||
2092 (((ptsig
->TYPE
& TTV_SIG_L
) == TTV_SIG_L
) &&
2093 (ttvfig
->ILATCHSIG
== NULL
) && (ttvfig
->ELATCHSIG
== NULL
)) ||
2094 (((ptsig
->TYPE
& TTV_SIG_R
) == TTV_SIG_R
) &&
2095 (ttvfig
->IPRESIG
== NULL
) && (ttvfig
->EPRESIG
== NULL
)) ||
2096 (((ptsig
->TYPE
& TTV_SIG_B
) == TTV_SIG_B
) &&
2097 (ttvfig
->IBREAKSIG
== NULL
) && (ttvfig
->EBREAKSIG
== NULL
)))
2098 ttv_delrefsig(ptsig
) ;
2108 /*****************************************************************************/
2109 /* function ttv_chainreflist() */
2111 /* ttvfig : ttvfig du liberer */
2112 /* pthead : tableau a liberer */
2113 /* nb : taille tableau */
2115 /* renvoie la chain des signaux d'un tableau */
2116 /*****************************************************************************/
2117 chain_list
*ttv_chainreflist(ttvfig
,pthead
,nb
)
2118 ttvfig_list
*ttvfig
;
2119 ttvsig_list
**pthead
;
2122 ttvsig_list
*ptsig
;
2123 chain_list
*chain
= NULL
;
2126 if(pthead
== NULL
) return NULL
;
2129 for(i
= 0 ; i
< nb
; i
++)
2131 ptsig
= *(pthead
+ i
) ;
2132 chain
= addchain(chain
,ptsig
) ;
2137 /*****************************************************************************/
2138 /* function ttv_tagttvfigfree() */
2140 /* ttvfig : ttvfig courante */
2141 /* ttvfigf1 : ttvfig f1 a marquer jusqu'a ttvfig */
2142 /* ttvfigf2 : ttvfig f2 a marquer jusqu'a ttvfig */
2143 /* type : type de marquage */
2145 /* marque les ttvfig d'un arbre suivant la priorite de liberation de type */
2146 /*****************************************************************************/
2147 void ttv_tagttvfigfree(ttvfig
,ttvfigf1
,ttvfigf2
,type
)
2148 ttvfig_list
*ttvfig
;
2149 ttvfig_list
*ttvfigf1
;
2150 ttvfig_list
*ttvfigf2
;
2153 ttvfig_list
*ttvfigx
;
2156 if((ttvfigf1
!= NULL
) || (ttvfigf2
!= NULL
))
2158 if((ttvfig
== ttvfigf1
) && (ttvfig
== ttvfigf2
))
2160 if((ttvfig
->STATUS
& TTV_STS_FREE_MASK
) < type
)
2162 ttvfig
->STATUS
&= ~(TTV_STS_FREE_MASK
) ;
2163 ttvfig
->STATUS
|= type
;
2168 ttvfigx
= ttvfigf1
;
2169 while((ttvfigx
!= NULL
) && (ttvfigx
!= ttvfig
))
2171 if((ttvfigx
->STATUS
& TTV_STS_FREE_MASK
) < type
)
2173 ttvfigx
->STATUS
&= ~(TTV_STS_FREE_MASK
) ;
2174 ttvfigx
->STATUS
|= type
;
2176 ttvfigx
= ttvfigx
->ROOT
;
2179 ttvfigx
= ttvfigf2
;
2180 while((ttvfigx
!= NULL
) && (ttvfigx
!= ttvfig
))
2182 if((ttvfigx
->STATUS
& TTV_STS_FREE_MASK
) < type
)
2184 ttvfigx
->STATUS
&= ~(TTV_STS_FREE_MASK
) ;
2185 ttvfigx
->STATUS
|= type
;
2187 ttvfigx
= ttvfigx
->ROOT
;
2193 if(((ttvfig
->STATUS
& TTV_STS_FREE_MASK
) >= type
) &&
2194 ((ttvfig
->STATUS
& TTV_STS_NOT_FREE
) != TTV_STS_NOT_FREE
))
2198 if((ttvfig
->STATUS
& TTV_STS_FREE_MASK
) < type
)
2200 ttvfig
->STATUS
&= ~(TTV_STS_FREE_MASK
) ;
2201 ttvfig
->STATUS
|= type
;
2203 for(chain
= ttvfig
->INS
; chain
!= NULL
; chain
= chain
->NEXT
)
2205 ttv_tagttvfigfree((ttvfig_list
*)chain
->DATA
,ttvfigf1
,ttvfigf2
,type
) ;
2211 /*****************************************************************************/
2212 /* function ttv_cleantagttvfig() */
2214 /* type : type de marquage */
2216 /* enleve les marques de free de toutes les ttvfig */
2217 /*****************************************************************************/
2218 void ttv_cleantagttvfig(type
)
2221 ttvfig_list
*ttvfigx
;
2223 for(ttvfigx
= TTV_LIST_TTVFIG
; ttvfigx
!= NULL
; ttvfigx
= ttvfigx
->NEXT
)
2225 ttvfigx
->STATUS
&= ~(type
) ;
2229 /*****************************************************************************/
2230 /* function ttv_addinfreelist() */
2232 /* ttvfig : pointeur sur la ttvfig ou il on peut supprimer de la memoire */
2233 /* type : type de liberation possible */
2235 /* met une figure dans la liste des figures ou il est possible de liberer */
2237 /*****************************************************************************/
2238 void ttv_addinfreelist(ttvfig
,type
)
2239 ttvfig_list
*ttvfig
;
2244 if((ttvfig
->STATUS
& type
) == 0)
2247 if(TTV_FREE_MEMTTVFIGHT
== NULL
)
2249 TTV_FREE_MEMTTVFIGHT
= addht(100) ;
2252 if((ptype
= (ptype_list
*)gethtitem(TTV_FREE_MEMTTVFIGHT
,(void *)ttvfig
)) == (void *)EMPTYHT
)
2254 TTV_FREE_MEMTTVFIG
= addptype(TTV_FREE_MEMTTVFIG
,type
,(void *)ttvfig
) ;
2255 addhtitem(TTV_FREE_MEMTTVFIGHT
,(void *)ttvfig
,(long)TTV_FREE_MEMTTVFIG
) ;
2259 ptype
->TYPE
|= type
& ttvfig
->STATUS
;
2263 /*****************************************************************************/
2264 /* function ttv_delinfreelist() */
2266 /* ttvfig : pointeur sur la ttvfig a supprimer de la liste */
2268 /* supprime une figure de la liste des figures ou il est possible de liberer */
2270 /* si ttvfig == NULL alors on les supprime toutes */
2271 /*****************************************************************************/
2272 int ttv_delinfreelist(head
,ttvfig
)
2274 ttvfig_list
*ttvfig
;
2277 ptype_list
*ptypesav
;
2284 freeptype(TTV_FREE_MEMTTVFIG
) ;
2285 TTV_FREE_MEMTTVFIG
= NULL
;
2286 delht(TTV_FREE_MEMTTVFIGHT
) ;
2287 TTV_FREE_MEMTTVFIGHT
= NULL
;
2297 if(TTV_FREE_MEMTTVFIGHT
!= NULL
)
2298 if(gethtitem(TTV_FREE_MEMTTVFIGHT
,(void *)ttvfig
) == EMPTYHT
)
2300 ptype
= TTV_FREE_MEMTTVFIG
;
2304 ptype
= head
->NEXT
;
2307 while(ptype
!= NULL
)
2309 if(ptype
->DATA
== (void*)ttvfig
)
2311 if(ptype
== TTV_FREE_MEMTTVFIG
)
2313 TTV_FREE_MEMTTVFIG
= TTV_FREE_MEMTTVFIG
->NEXT
;
2314 ptype
->NEXT
= NULL
;
2319 ptypesav
->NEXT
= ptype
->NEXT
;
2320 ptype
->NEXT
= NULL
;
2323 delhtitem(TTV_FREE_MEMTTVFIGHT
,(void *)ttvfig
) ;
2327 ptype
= ptype
->NEXT
;
2334 /*****************************************************************************/
2335 /* function ttv_freememoryifmax() */
2337 /* ttvfig : pointeur sur la ttvfig ou il faut supprimer de la memoire */
2338 /* type : type de memoire qu'il faut liberer */
2340 /* fonction de liberation de memoire sur une ttvfig en fonction du type */
2342 /* 1 si la memoire a ete supprimer 0 sinon */
2343 /*****************************************************************************/
2344 int ttv_freememoryifmax(ttvfig
,type
)
2345 ttvfig_list
*ttvfig
;
2350 if((ttvfig
->STATUS
& TTV_STS_LOCK
) == TTV_STS_LOCK
)
2353 if(((type
& (TTV_STS_D
|TTV_STS_E
|TTV_STS_F
|TTV_STS_T
|TTV_STS_J
|TTV_STS_D
)) != 0) && (TTV_NUMB_LINE
>= TTV_MAX_LINE
))
2354 res
= ttv_freettvfigmemory(ttvfig
,type
&~(TTV_STS_S
)) ;
2355 if(((type
& TTV_STS_S
) != 0) && (TTV_NUMB_SIG
>= TTV_MAX_SIG
))
2356 res
= ttv_freettvfigmemory(ttvfig
,type
&~(TTV_STS_D
|TTV_STS_E
|TTV_STS_F
|TTV_STS_T
|TTV_STS_J
|TTV_STS_D
)) ;
2361 /*****************************************************************************/
2362 /* function ttv_freememoryiffull() */
2364 /* ttvfig : pointeur sur la ttvfig ou il faut supprimer de la memoire */
2365 /* type : type de memoire qu'il faut liberer */
2367 /* fonction de liberation de memoire sur une ttvfig en fonction du type */
2369 /* 1 si la memoire a ete supprimer 0 sinon */
2370 /*****************************************************************************/
2371 int ttv_freememoryiffull(ttvfig
,type
)
2372 ttvfig_list
*ttvfig
;
2377 if((ttvfig
->STATUS
& TTV_STS_LOCK
) == TTV_STS_LOCK
)
2380 if(((type
& (TTV_STS_D
|TTV_STS_E
|TTV_STS_F
|TTV_STS_T
|TTV_STS_J
|TTV_STS_D
)) != 0) && (TTV_NUMB_LINE
>= TTV_MAX_LINE
) && (TTV_FREE_LBLOC
== NULL
))
2381 res
= ttv_freettvfigmemory(ttvfig
,type
&~(TTV_STS_S
)) ;
2382 if(((type
& TTV_STS_S
) != 0) && (TTV_NUMB_SIG
>= TTV_MAX_SIG
) && (TTV_FREE_SBLOC
== NULL
))
2383 res
= ttv_freettvfigmemory(ttvfig
,type
&~(TTV_STS_D
|TTV_STS_E
|TTV_STS_F
|TTV_STS_T
|TTV_STS_J
|TTV_STS_D
)) ;
2388 /*****************************************************************************/
2389 /* function ttv_freettvfigmemory() */
2391 /* ttvfig : pointeur sur la ttvfig ou il faut supprimer de la memoire */
2392 /* type : type de memoire qu'il faut liberer */
2394 /* fonction de liberation de memoire sur une ttvfig en fonction du type */
2396 /* 1 si la memoire a ete supprimer 0 sinon */
2397 /*****************************************************************************/
2398 int ttv_freettvfigmemory(ttvfig
,type
)
2399 ttvfig_list
*ttvfig
;
2404 if((ttvfig
->STATUS
& TTV_STS_LOCK
) == TTV_STS_LOCK
)
2407 if(((type
& TTV_STS_D
) == TTV_STS_D
) || ((type
& TTV_STS_C
) == TTV_STS_C
))
2409 ttv_freedualline(ttvfig
,TTV_STS_DUAL_D
) ;
2410 ttvfig
->STATUS
&= ~(TTV_STS_D
|TTV_STS_DENOTINPT
) ;
2411 ttvfig
->NBDBLOC
= (long)0 ;
2412 if(ttv_freelbloclist(ttvfig
->DBLOC
) == 0)
2414 else ttvfig
->DBLOC
= NULL
;
2417 if(((type
& TTV_STS_E
) == TTV_STS_E
) || ((type
& TTV_STS_S
) == TTV_STS_S
))
2419 ttv_freedualline(ttvfig
,TTV_STS_DUAL_E
) ;
2420 ttvfig
->STATUS
&= ~(TTV_STS_E
|TTV_STS_DENOTINPT
) ;
2421 ttvfig
->NBEBLOC
= (long)0 ;
2422 if(ttv_freelbloclist(ttvfig
->EBLOC
) == 0)
2424 else ttvfig
->EBLOC
= NULL
;
2427 if(((type
& TTV_STS_F
) == TTV_STS_F
) || ((type
& TTV_STS_S
) == TTV_STS_S
))
2429 ttv_freedualline(ttvfig
,TTV_STS_DUAL_F
) ;
2430 ttvfig
->STATUS
&= ~(TTV_STS_F
|TTV_STS_DENOTINPT
) ;
2431 ttvfig
->NBFBLOC
= (long)0 ;
2432 if(ttv_freelbloclist(ttvfig
->FBLOC
) == 0)
2434 else ttvfig
->FBLOC
= NULL
;
2437 if(((type
& TTV_STS_T
) == TTV_STS_T
) || ((type
& TTV_STS_C
) == TTV_STS_C
))
2439 ttv_freedualline(ttvfig
,TTV_STS_DUAL_T
) ;
2440 ttvfig
->STATUS
&= ~(TTV_STS_T
) ;
2441 ttvfig
->NBTBLOC
= (long)0 ;
2442 if(ttv_freelbloclist(ttvfig
->TBLOC
) == 0)
2444 else ttvfig
->TBLOC
= NULL
;
2447 if((type
& TTV_STS_J
) == TTV_STS_J
)
2449 ttv_freedualline(ttvfig
,TTV_STS_DUAL_J
) ;
2450 ttvfig
->STATUS
&= ~(TTV_STS_J
) ;
2451 ttvfig
->NBJBLOC
= (long)0 ;
2452 if(ttv_freelbloclist(ttvfig
->JBLOC
) == 0)
2454 else ttvfig
->JBLOC
= NULL
;
2457 if((type
& TTV_STS_P
) == TTV_STS_P
)
2459 ttv_freedualline(ttvfig
,TTV_STS_DUAL_P
) ;
2460 ttvfig
->STATUS
&= ~(TTV_STS_P
) ;
2461 ttvfig
->NBPBLOC
= (long)0 ;
2462 if(ttv_freelbloclist(ttvfig
->PBLOC
) == 0)
2464 else ttvfig
->PBLOC
= NULL
;
2467 if((type
& TTV_STS_S
) == TTV_STS_S
)
2469 ttvfig
->STATUS
&= ~(TTV_STS_S
) ;
2470 ttvfig
->NBISIG
= (long)0 ;
2472 ttv_delsigtab(ttvfig
) ;
2473 if(ttv_freesbloclist(ttvfig
->ISIG
) == 0)
2475 else ttvfig
->ISIG
= NULL
;
2476 if((getptype(ttvfig
->USER
,TTV_STS_HTAB_S
)) != NULL
)
2478 ttv_freehtabttvfig(ttvfig
,TTV_STS_S
) ;
2479 ttv_builthtabttvfig(ttvfig
,TTV_STS_S
) ;
2483 if((type
& TTV_STS_C
) == TTV_STS_C
)
2485 ttvfig
->STATUS
&= ~(TTV_STS_C
) ;
2486 if(ttv_freereflist(ttvfig
,ttvfig
->NCSIG
, ttvfig
->NBNCSIG
) != 0)
2488 ttvfig
->NCSIG
= NULL
;
2489 ttvfig
->NBNCSIG
= (long)0 ;
2492 if(ttv_freereflist(ttvfig
,ttvfig
->CONSIG
, ttvfig
->NBCONSIG
) != 0)
2494 ttvfig
->CONSIG
= NULL
;
2495 ttvfig
->NBCONSIG
= (long)0 ;
2498 if((getptype(ttvfig
->USER
,TTV_STS_HTAB_L
)) != NULL
)
2500 ttv_freehtabttvfig(ttvfig
,TTV_STS_L
) ;
2501 ttv_builthtabttvfig(ttvfig
,TTV_STS_L
) ;
2508 /*****************************************************************************/
2509 /* function ttv_allocdualline() */
2511 /* ttvfig : ttvfig ou il faut contruire le graphe dual */
2512 /* status : etat dual demander */
2514 /* ajoute a chaque noeud du graphe des liens dual du type demander */
2515 /*****************************************************************************/
2516 void ttv_allocdualline(ttvfig
,status
)
2517 ttvfig_list
*ttvfig
;
2520 ttvline_list
*ptline
;
2521 ttvline_list
*ptlinex
;
2522 ttvevent_list
*ptnode
;
2523 ttvlbloc_list
*ptlbloc
;
2525 chain_list
*chain
= NULL
;
2526 chain_list
*chainx
;
2529 if(((status
& TTV_STS_DUAL_T
) == TTV_STS_DUAL_T
) &&
2530 ((ttvfig
->STATUS
& TTV_STS_DUAL_T
) != TTV_STS_DUAL_T
) &&
2531 ((ttvfig
->STATUS
& TTV_STS_T
) == TTV_STS_T
))
2533 chain
= addchain(chain
,(void *)ttvfig
->TBLOC
) ;
2534 ttvfig
->STATUS
|= TTV_STS_DUAL_T
;
2537 if(((status
& TTV_STS_DUAL_J
) == TTV_STS_DUAL_J
) &&
2538 ((ttvfig
->STATUS
& TTV_STS_DUAL_J
) != TTV_STS_DUAL_J
) &&
2539 ((ttvfig
->STATUS
& TTV_STS_J
) == TTV_STS_J
))
2541 chain
= addchain(chain
,(void *)ttvfig
->JBLOC
) ;
2542 ttvfig
->STATUS
|= TTV_STS_DUAL_J
;
2545 if(((status
& TTV_STS_DUAL_P
) == TTV_STS_DUAL_P
) &&
2546 ((ttvfig
->STATUS
& TTV_STS_DUAL_P
) != TTV_STS_DUAL_P
) &&
2547 ((ttvfig
->STATUS
& TTV_STS_P
) == TTV_STS_P
))
2549 chain
= addchain(chain
,(void *)ttvfig
->PBLOC
) ;
2550 ttvfig
->STATUS
|= TTV_STS_DUAL_P
;
2553 if(((status
& TTV_STS_DUAL_D
) == TTV_STS_DUAL_D
) &&
2554 ((ttvfig
->STATUS
& TTV_STS_DUAL_D
) != TTV_STS_DUAL_D
) &&
2555 ((ttvfig
->STATUS
& TTV_STS_D
) == TTV_STS_D
))
2557 chain
= addchain(chain
,(void *)ttvfig
->DBLOC
) ;
2558 ttvfig
->STATUS
|= TTV_STS_DUAL_D
;
2561 if(((status
& TTV_STS_DUAL_E
) == TTV_STS_DUAL_E
) &&
2562 ((ttvfig
->STATUS
& TTV_STS_DUAL_E
) != TTV_STS_DUAL_E
) &&
2563 ((ttvfig
->STATUS
& TTV_STS_E
) == TTV_STS_E
))
2565 chain
= addchain(chain
,(void *)ttvfig
->EBLOC
) ;
2566 ttvfig
->STATUS
|= TTV_STS_DUAL_E
;
2569 if(((status
& TTV_STS_DUAL_F
) == TTV_STS_DUAL_F
) &&
2570 ((ttvfig
->STATUS
& TTV_STS_DUAL_F
) != TTV_STS_DUAL_F
) &&
2571 ((ttvfig
->STATUS
& TTV_STS_F
) == TTV_STS_F
))
2573 chain
= addchain(chain
,(void *)ttvfig
->FBLOC
) ;
2574 ttvfig
->STATUS
|= TTV_STS_DUAL_F
;
2577 for(chainx
= chain
; chainx
!= NULL
; chainx
= chainx
->NEXT
)
2578 for(ptlbloc
= (ttvlbloc_list
*)chainx
->DATA
; ptlbloc
!= NULL
;
2579 ptlbloc
= ptlbloc
->NEXT
)
2581 for(i
= 0 ; i
< TTV_MAX_LBLOC
; i
++)
2583 ptline
= ptlbloc
->LINE
+ i
;
2584 if((ptline
->TYPE
& TTV_LINE_FR
) == TTV_LINE_FR
) continue ;
2585 ptnode
= ptline
->NODE
;
2587 ptline
->TYPE
|= TTV_LINE_ROOT_DUAL
;
2589 if((ptline
->TYPE
& (TTV_LINE_D
| TTV_LINE_E
| TTV_LINE_F
)) != 0)
2591 ptype
= getptype(ptnode
->USER
,TTV_NODE_DUALLINE
) ;
2593 ptype
= ptnode
->USER
= addptype(ptnode
->USER
,TTV_NODE_DUALLINE
,NULL
) ;
2597 ptype
= getptype(ptnode
->USER
,TTV_NODE_DUALPATH
) ;
2599 ptype
= ptnode
->USER
= addptype(ptnode
->USER
,TTV_NODE_DUALPATH
,NULL
) ;
2602 ptype
->DATA
= (void *)addchain((chain_list
*)ptype
->DATA
,ptline
) ;
2604 if(((chain_list
*)ptype
->DATA
)->NEXT
!= NULL
)
2606 ptlinex
= (ttvline_list
*)(((chain_list
*)ptype
->DATA
)->NEXT
)->DATA
;
2607 ptlinex
->TYPE
&= ~(TTV_LINE_ROOT_DUAL
) ;
2609 if((ptlinex
->FIG
!= ptline
->FIG
) ||
2610 ((ptline
->TYPE
& TTV_LINE_TYPE
) != (ptlinex
->TYPE
& TTV_LINE_TYPE
)))
2612 ptlinex
->TYPE
|= TTV_LINE_PREV_DUAL
;
2614 addptype(ptlinex
->USER
,TTV_LINE_PREVLDUAL
,ptype
->DATA
) ;
2623 /*****************************************************************************/
2624 /* function ttv_freedualline() */
2626 /* ttvfig : ttvfig ou il faut detruire le graphe dual */
2627 /* status : etat dual demander */
2629 /* enleve les liens du graphe dual */
2630 /*****************************************************************************/
2631 void ttv_freedualline(ttvfig
,status
)
2632 ttvfig_list
*ttvfig
;
2635 ttvline_list
*ptline
;
2636 ttvline_list
*ptlinex
;
2637 ttvevent_list
*ptnode
;
2638 ttvlbloc_list
*ptlbloc
;
2640 chain_list
*chain
= NULL
;
2641 chain_list
*chainx
;
2642 chain_list
*chainline
;
2643 chain_list
*chainsav
;
2646 if(((status
& TTV_STS_DUAL_T
) == TTV_STS_DUAL_T
) &&
2647 ((ttvfig
->STATUS
& TTV_STS_DUAL_T
) == TTV_STS_DUAL_T
) &&
2648 ((ttvfig
->STATUS
& TTV_STS_T
) == TTV_STS_T
))
2650 chain
= addchain(chain
,(void *)ttvfig
->TBLOC
) ;
2651 ttvfig
->STATUS
&= ~(TTV_STS_DUAL_T
) ;
2654 if(((status
& TTV_STS_DUAL_J
) == TTV_STS_DUAL_J
) &&
2655 ((ttvfig
->STATUS
& TTV_STS_DUAL_J
) == TTV_STS_DUAL_J
) &&
2656 ((ttvfig
->STATUS
& TTV_STS_J
) == TTV_STS_J
))
2658 chain
= addchain(chain
,(void *)ttvfig
->JBLOC
) ;
2659 ttvfig
->STATUS
&= ~(TTV_STS_DUAL_J
) ;
2662 if(((status
& TTV_STS_DUAL_P
) == TTV_STS_DUAL_P
) &&
2663 ((ttvfig
->STATUS
& TTV_STS_DUAL_P
) == TTV_STS_DUAL_P
) &&
2664 ((ttvfig
->STATUS
& TTV_STS_P
) == TTV_STS_P
))
2666 chain
= addchain(chain
,(void *)ttvfig
->PBLOC
) ;
2667 ttvfig
->STATUS
&= ~(TTV_STS_DUAL_P
) ;
2670 if(((status
& TTV_STS_DUAL_D
) == TTV_STS_DUAL_D
) &&
2671 ((ttvfig
->STATUS
& TTV_STS_DUAL_D
) == TTV_STS_DUAL_D
) &&
2672 ((ttvfig
->STATUS
& TTV_STS_D
) == TTV_STS_D
))
2674 chain
= addchain(chain
,(void *)ttvfig
->DBLOC
) ;
2675 ttvfig
->STATUS
&= ~(TTV_STS_DUAL_D
) ;
2678 if(((status
& TTV_STS_DUAL_E
) == TTV_STS_DUAL_E
) &&
2679 ((ttvfig
->STATUS
& TTV_STS_DUAL_E
) == TTV_STS_DUAL_E
) &&
2680 ((ttvfig
->STATUS
& TTV_STS_E
) == TTV_STS_E
))
2682 chain
= addchain(chain
,(void *)ttvfig
->EBLOC
) ;
2683 ttvfig
->STATUS
&= ~(TTV_STS_DUAL_E
) ;
2686 if(((status
& TTV_STS_DUAL_F
) == TTV_STS_DUAL_F
) &&
2687 ((ttvfig
->STATUS
& TTV_STS_DUAL_F
) == TTV_STS_DUAL_F
) &&
2688 ((ttvfig
->STATUS
& TTV_STS_F
) == TTV_STS_F
))
2690 chain
= addchain(chain
,(void *)ttvfig
->FBLOC
) ;
2691 ttvfig
->STATUS
&= ~(TTV_STS_DUAL_F
) ;
2694 for(chainx
= chain
; chainx
!= NULL
; chainx
= chainx
->NEXT
)
2695 for(ptlbloc
= (ttvlbloc_list
*)chainx
->DATA
; ptlbloc
!= NULL
;
2696 ptlbloc
= ptlbloc
->NEXT
)
2698 for(i
= 0 ; i
< TTV_MAX_LBLOC
; i
++)
2700 ptline
= ptlbloc
->LINE
+ i
;
2702 if((ptline
->TYPE
& TTV_LINE_FR
) == TTV_LINE_FR
)
2705 if((ptline
->TYPE
& TTV_LINE_PREV_DUAL
) == TTV_LINE_PREV_DUAL
)
2707 chainsav
= (chain_list
*)getptype(ptline
->USER
,
2708 TTV_LINE_PREVLDUAL
)->DATA
;
2709 chainsav
= chainsav
->NEXT
;
2710 for(chainline
= chainsav
->NEXT
; chainline
!= NULL
;
2711 chainline
= chainline
->NEXT
)
2713 ptlinex
= (ttvline_list
*)chainline
->DATA
;
2714 if((ptlinex
->TYPE
& TTV_LINE_PREV_DUAL
) == TTV_LINE_PREV_DUAL
)
2716 chainsav
= chainline
;
2719 chainsav
->NEXT
= NULL
;
2720 chainsav
= (chain_list
*)getptype(ptline
->USER
,
2721 TTV_LINE_PREVLDUAL
)->DATA
;
2722 freechain(chainsav
->NEXT
) ;
2723 chainsav
->NEXT
= chainline
;
2725 if(chainline
!= NULL
)
2726 getptype(ptlinex
->USER
,TTV_LINE_PREVLDUAL
)->DATA
= (void *)chainsav
;
2728 ptline
->USER
= delptype(ptline
->USER
,TTV_LINE_PREVLDUAL
) ;
2729 ptline
->TYPE
&= ~(TTV_LINE_PREV_DUAL
) ;
2731 else if((ptline
->TYPE
& TTV_LINE_ROOT_DUAL
) == TTV_LINE_ROOT_DUAL
)
2733 ptnode
= ptline
->NODE
;
2734 ptline
->TYPE
&= ~(TTV_LINE_ROOT_DUAL
) ;
2736 if((ptline
->TYPE
& (TTV_LINE_D
| TTV_LINE_E
| TTV_LINE_F
)) != 0)
2738 ptype
= getptype(ptnode
->USER
,TTV_NODE_DUALLINE
) ;
2742 ptype
= getptype(ptnode
->USER
,TTV_NODE_DUALPATH
) ;
2745 for(chainline
= (chain_list
*)ptype
->DATA
; chainline
!= NULL
;
2746 chainline
= chainline
->NEXT
)
2748 ptlinex
= (ttvline_list
*)chainline
->DATA
;
2749 if((ptlinex
->TYPE
& TTV_LINE_PREV_DUAL
) == TTV_LINE_PREV_DUAL
)
2751 chainsav
= chainline
;
2754 if(chainline
!= NULL
)
2756 ptlinex
->USER
= delptype(ptlinex
->USER
,TTV_LINE_PREVLDUAL
) ;
2757 ptlinex
->TYPE
|= TTV_LINE_ROOT_DUAL
;
2758 ptlinex
->TYPE
&= ~(TTV_LINE_PREV_DUAL
) ;
2759 chainsav
->NEXT
= NULL
;
2762 freechain(ptype
->DATA
) ;
2763 ptype
->DATA
= chainline
;
2771 /*****************************************************************************/
2772 /* function ttv_alloclinedelay() */
2774 /* line a allouer */
2776 /* ajoute la structure delay d'une line */
2777 /*****************************************************************************/
2778 ttvdelay_list
*ttv_alloclinedelay(line
)
2779 ttvline_list
*line
;
2781 ttvfig_list
*ttvfig
= line
->FIG
;
2786 pos
= ttv_getdelaypos(line
->FIG
,line
->TYPE
,&size
) ;
2787 if(line
->INDEX
== TTV_LINE_NOINDEX
)
2788 ttv_alloclineindex(ttvfig
,line
->TYPE
) ;
2789 index
= line
->INDEX
;
2790 return(ttv_allocdelayline(ttvfig
,pos
,index
,size
)) ;
2793 /*****************************************************************************/
2794 /* function ttv_allocdelayline() */
2796 /* line a allouer */
2798 /* ajoute la structure delay d'une line */
2799 /*****************************************************************************/
2800 ttvdelay_list
*ttv_allocdelayline(ttvfig
,pos
,index
,size
)
2801 ttvfig_list
*ttvfig
;
2806 ttvdelay_list
**delay
;
2807 ttvdelay_list
*ptdelay
;
2810 if(ttvfig
->DELAY
== NULL
)
2812 ttvfig
->DELAY
= (ttvdelay_list
***)mbkalloc(6 * sizeof(ttvdelay_list
**)) ;
2813 for(i
= 0 ; i
< 6 ; i
++)
2814 ttvfig
->DELAY
[i
] = NULL
;
2817 delay
= ttvfig
->DELAY
[pos
] ;
2821 ttvfig
->DELAY
[pos
] = mbkalloc((size
+ 1) * sizeof(ttvdelay_list
*)) ;
2822 delay
= ttvfig
->DELAY
[pos
] ;
2823 for(i
= 0 ; i
< size
; i
++)
2825 delay
[i
] = TTV_DELAY_END
;
2828 ptdelay
= delay
[index
] ;
2832 delay
[index
] = mbkalloc(sizeof(ttvdelay_list
)) ;
2833 ptdelay
= delay
[index
] ;
2834 ptdelay
->VALMAX
= TTV_NOTIME
;
2835 ptdelay
->VALMIN
= TTV_NOTIME
;
2836 ptdelay
->FMAX
= TTV_NOSLOPE
;
2837 ptdelay
->FMIN
= TTV_NOSLOPE
;
2838 ptdelay
->CMAX
= TTV_NOCAPA
;
2839 ptdelay
->CMIN
= TTV_NOCAPA
;
2840 ptdelay
->CDRIVERMAX
= -1.0 ;
2841 ptdelay
->CDRIVERMIN
= -1.0 ;
2842 ptdelay
->RDRIVERMAX
= -1.0 ;
2843 ptdelay
->RDRIVERMIN
= -1.0 ;
2844 ptdelay
->USER
= NULL
;
2850 /*****************************************************************************/
2851 /* function ttv_freettvfigdelay() */
2853 /* line a allouer */
2855 /* ajoute la structure delay d'une line */
2856 /*****************************************************************************/
2857 void ttv_freettvfigdelay(ttvfig
)
2858 ttvfig_list
*ttvfig
;
2860 ttvdelay_list
**delay
;
2865 if(ttvfig
->DELAY
== NULL
)
2870 tab
[TTV_DELAY_P
] = ttvfig
->NBPBLOC
;
2871 tab
[TTV_DELAY_J
] = ttvfig
->NBJBLOC
;
2872 tab
[TTV_DELAY_T
] = ttvfig
->NBTBLOC
;
2873 tab
[TTV_DELAY_F
] = ttvfig
->NBFBLOC
;
2874 tab
[TTV_DELAY_E
] = ttvfig
->NBEBLOC
;
2875 tab
[TTV_DELAY_D
] = ttvfig
->NBDBLOC
;
2877 for(i
= 0 ; i
< 6 ; i
++)
2879 if(ttvfig
->DELAY
[i
] != NULL
)
2881 delay
= ttvfig
->DELAY
[i
] ;
2882 for(j
= 0 ; j
< tab
[i
] ; j
++)
2888 mbkfree(ttvfig
->DELAY
) ;
2890 ttvfig
->DELAY
= NULL
;
2893 /*****************************************************************************/
2894 /* function ttv_alloclineindex() */
2896 /* ttvfig : ttvfig ou il faut contruire le graphe dual */
2897 /* type : type de line */
2899 /* ajoute l'index a chaque ttvline */
2900 /*****************************************************************************/
2901 void ttv_alloclineindex(ttvfig
,type
)
2902 ttvfig_list
*ttvfig
;
2905 ttvline_list
*ptline
;
2906 ttvlbloc_list
*ptlbloc
;
2907 chain_list
*chain
= NULL
;
2908 chain_list
*chainx
;
2912 type
&= TTV_LINE_TYPE
;
2914 if((type
& TTV_LINE_T
) == TTV_LINE_T
)
2916 chain
= addchain(chain
,(void *)ttvfig
->TBLOC
) ;
2919 if((type
& TTV_LINE_J
) == TTV_LINE_J
)
2921 chain
= addchain(chain
,(void *)ttvfig
->JBLOC
) ;
2924 if((type
& TTV_LINE_P
) == TTV_LINE_P
)
2926 chain
= addchain(chain
,(void *)ttvfig
->PBLOC
) ;
2929 if((type
& TTV_LINE_D
) == TTV_LINE_D
)
2931 chain
= addchain(chain
,(void *)ttvfig
->DBLOC
) ;
2934 if((type
& TTV_LINE_E
) == TTV_LINE_E
)
2936 chain
= addchain(chain
,(void *)ttvfig
->EBLOC
) ;
2939 if((type
& TTV_LINE_F
) == TTV_LINE_F
)
2941 chain
= addchain(chain
,(void *)ttvfig
->FBLOC
) ;
2944 for(chainx
= chain
; chainx
!= NULL
; chainx
= chainx
->NEXT
)
2947 for(ptlbloc
= (ttvlbloc_list
*)chainx
->DATA
; ptlbloc
!= NULL
;
2948 ptlbloc
= ptlbloc
->NEXT
)
2950 for(i
= 0 ; i
< TTV_MAX_LBLOC
; i
++)
2952 ptline
= ptlbloc
->LINE
+ i
;
2953 if((ptline
->TYPE
& TTV_LINE_FR
) == TTV_LINE_FR
) continue ;
2954 ptline
->INDEX
= index
++ ;
2962 /*****************************************************************************/
2963 /* function ttv_allocsigcapas () */
2964 /*****************************************************************************/
2965 ttvsig_capas
*ttv_allocsigcapas ( float cu
, float cumin
, float cumax
,
2966 float cd
, float cdmin
, float cdmax
)
2968 ttvsig_capas
*ttvsigcapa
;
2970 ttvsigcapa
= (ttvsig_capas
*)mbkalloc(sizeof(ttvsig_capas
));
2972 ttvsigcapa
->CAPAUP
= cu
;
2973 ttvsigcapa
->CAPAUPMIN
= cumin
;
2974 ttvsigcapa
->CAPAUPMAX
= cumax
;
2975 ttvsigcapa
->CAPADN
= cd
;
2976 ttvsigcapa
->CAPADNMIN
= cdmin
;
2977 ttvsigcapa
->CAPADNMAX
= cdmax
;
2982 ttvcritic_list
*ttv_dupcritic(ttvcritic_list
*pt
)
2985 if (pt
==NULL
) return NULL
;
2986 cr
=ttv_getnewcritic();
2987 memcpy(cr
, pt
, sizeof(ttvcritic_list
));
2989 if ((cr
->NODE_FLAG
& TTV_NODE_FLAG_NOALLOC
)==0)
2991 if (cr
->NAME
!=NULL
) cr
->NAME
=mbkstrdup(cr
->NAME
);
2992 if (cr
->NETNAME
!=NULL
) cr
->NETNAME
=mbkstrdup(cr
->NETNAME
);
2994 cr
->NEXT
=ttv_dupcritic(pt
->NEXT
);
2998 ttvpath_list
*ttv_duppath(ttvpath_list
*pt
)
3002 npt
=ttv_getnewpath();
3003 memcpy(npt
, pt
, sizeof(ttvpath_list
));
3005 npt
->USER
=dupptypelst(npt
->USER
);
3006 npt
->LATCHLIST
=dupptypelst(npt
->LATCHLIST
);
3007 npt
->MD
=npt
->MF
=NULL
;
3008 npt
->CRITIC
=ttv_dupcritic(npt
->CRITIC
);