00001
00019 #include "fxuInt.h"
00020
00024
00028
00029
00030
00042 void Fxu_ListMatrixAddVariable( Fxu_Matrix * p, Fxu_Var * pLink )
00043 {
00044 Fxu_ListVar * pList = &p->lVars;
00045 if ( pList->pHead == NULL )
00046 {
00047 pList->pHead = pLink;
00048 pList->pTail = pLink;
00049 pLink->pPrev = NULL;
00050 pLink->pNext = NULL;
00051 }
00052 else
00053 {
00054 pLink->pNext = NULL;
00055 pList->pTail->pNext = pLink;
00056 pLink->pPrev = pList->pTail;
00057 pList->pTail = pLink;
00058 }
00059 pList->nItems++;
00060 }
00061
00073 void Fxu_ListMatrixDelVariable( Fxu_Matrix * p, Fxu_Var * pLink )
00074 {
00075 Fxu_ListVar * pList = &p->lVars;
00076 if ( pList->pHead == pLink )
00077 pList->pHead = pLink->pNext;
00078 if ( pList->pTail == pLink )
00079 pList->pTail = pLink->pPrev;
00080 if ( pLink->pPrev )
00081 pLink->pPrev->pNext = pLink->pNext;
00082 if ( pLink->pNext )
00083 pLink->pNext->pPrev = pLink->pPrev;
00084 pList->nItems--;
00085 }
00086
00087
00088
00089
00101 void Fxu_ListMatrixAddCube( Fxu_Matrix * p, Fxu_Cube * pLink )
00102 {
00103 Fxu_ListCube * pList = &p->lCubes;
00104 if ( pList->pHead == NULL )
00105 {
00106 pList->pHead = pLink;
00107 pList->pTail = pLink;
00108 pLink->pPrev = NULL;
00109 pLink->pNext = NULL;
00110 }
00111 else
00112 {
00113 pLink->pNext = NULL;
00114 pList->pTail->pNext = pLink;
00115 pLink->pPrev = pList->pTail;
00116 pList->pTail = pLink;
00117 }
00118 pList->nItems++;
00119 }
00120
00132 void Fxu_ListMatrixDelCube( Fxu_Matrix * p, Fxu_Cube * pLink )
00133 {
00134 Fxu_ListCube * pList = &p->lCubes;
00135 if ( pList->pHead == pLink )
00136 pList->pHead = pLink->pNext;
00137 if ( pList->pTail == pLink )
00138 pList->pTail = pLink->pPrev;
00139 if ( pLink->pPrev )
00140 pLink->pPrev->pNext = pLink->pNext;
00141 if ( pLink->pNext )
00142 pLink->pNext->pPrev = pLink->pPrev;
00143 pList->nItems--;
00144 }
00145
00146
00147
00148
00160 void Fxu_ListMatrixAddSingle( Fxu_Matrix * p, Fxu_Single * pLink )
00161 {
00162 Fxu_ListSingle * pList = &p->lSingles;
00163 if ( pList->pHead == NULL )
00164 {
00165 pList->pHead = pLink;
00166 pList->pTail = pLink;
00167 pLink->pPrev = NULL;
00168 pLink->pNext = NULL;
00169 }
00170 else
00171 {
00172 pLink->pNext = NULL;
00173 pList->pTail->pNext = pLink;
00174 pLink->pPrev = pList->pTail;
00175 pList->pTail = pLink;
00176 }
00177 pList->nItems++;
00178 }
00179
00191 void Fxu_ListMatrixDelSingle( Fxu_Matrix * p, Fxu_Single * pLink )
00192 {
00193 Fxu_ListSingle * pList = &p->lSingles;
00194 if ( pList->pHead == pLink )
00195 pList->pHead = pLink->pNext;
00196 if ( pList->pTail == pLink )
00197 pList->pTail = pLink->pPrev;
00198 if ( pLink->pPrev )
00199 pLink->pPrev->pNext = pLink->pNext;
00200 if ( pLink->pNext )
00201 pLink->pNext->pPrev = pLink->pPrev;
00202 pList->nItems--;
00203 }
00204
00205
00206
00207
00219 void Fxu_ListTableAddDivisor( Fxu_Matrix * p, Fxu_Double * pLink )
00220 {
00221 Fxu_ListDouble * pList = &(p->pTable[pLink->Key]);
00222 if ( pList->pHead == NULL )
00223 {
00224 pList->pHead = pLink;
00225 pList->pTail = pLink;
00226 pLink->pPrev = NULL;
00227 pLink->pNext = NULL;
00228 }
00229 else
00230 {
00231 pLink->pNext = NULL;
00232 pList->pTail->pNext = pLink;
00233 pLink->pPrev = pList->pTail;
00234 pList->pTail = pLink;
00235 }
00236 pList->nItems++;
00237 p->nDivs++;
00238 }
00239
00251 void Fxu_ListTableDelDivisor( Fxu_Matrix * p, Fxu_Double * pLink )
00252 {
00253 Fxu_ListDouble * pList = &(p->pTable[pLink->Key]);
00254 if ( pList->pHead == pLink )
00255 pList->pHead = pLink->pNext;
00256 if ( pList->pTail == pLink )
00257 pList->pTail = pLink->pPrev;
00258 if ( pLink->pPrev )
00259 pLink->pPrev->pNext = pLink->pNext;
00260 if ( pLink->pNext )
00261 pLink->pNext->pPrev = pLink->pPrev;
00262 pList->nItems--;
00263 p->nDivs--;
00264 }
00265
00266
00267
00268
00280 void Fxu_ListCubeAddLiteral( Fxu_Cube * pCube, Fxu_Lit * pLink )
00281 {
00282 Fxu_ListLit * pList = &(pCube->lLits);
00283 if ( pList->pHead == NULL )
00284 {
00285 pList->pHead = pLink;
00286 pList->pTail = pLink;
00287 pLink->pHPrev = NULL;
00288 pLink->pHNext = NULL;
00289 }
00290 else
00291 {
00292 pLink->pHNext = NULL;
00293 pList->pTail->pHNext = pLink;
00294 pLink->pHPrev = pList->pTail;
00295 pList->pTail = pLink;
00296 }
00297 pList->nItems++;
00298 }
00299
00311 void Fxu_ListCubeDelLiteral( Fxu_Cube * pCube, Fxu_Lit * pLink )
00312 {
00313 Fxu_ListLit * pList = &(pCube->lLits);
00314 if ( pList->pHead == pLink )
00315 pList->pHead = pLink->pHNext;
00316 if ( pList->pTail == pLink )
00317 pList->pTail = pLink->pHPrev;
00318 if ( pLink->pHPrev )
00319 pLink->pHPrev->pHNext = pLink->pHNext;
00320 if ( pLink->pHNext )
00321 pLink->pHNext->pHPrev = pLink->pHPrev;
00322 pList->nItems--;
00323 }
00324
00325
00326
00327
00339 void Fxu_ListVarAddLiteral( Fxu_Var * pVar, Fxu_Lit * pLink )
00340 {
00341 Fxu_ListLit * pList = &(pVar->lLits);
00342 if ( pList->pHead == NULL )
00343 {
00344 pList->pHead = pLink;
00345 pList->pTail = pLink;
00346 pLink->pVPrev = NULL;
00347 pLink->pVNext = NULL;
00348 }
00349 else
00350 {
00351 pLink->pVNext = NULL;
00352 pList->pTail->pVNext = pLink;
00353 pLink->pVPrev = pList->pTail;
00354 pList->pTail = pLink;
00355 }
00356 pList->nItems++;
00357 }
00358
00370 void Fxu_ListVarDelLiteral( Fxu_Var * pVar, Fxu_Lit * pLink )
00371 {
00372 Fxu_ListLit * pList = &(pVar->lLits);
00373 if ( pList->pHead == pLink )
00374 pList->pHead = pLink->pVNext;
00375 if ( pList->pTail == pLink )
00376 pList->pTail = pLink->pVPrev;
00377 if ( pLink->pVPrev )
00378 pLink->pVPrev->pVNext = pLink->pVNext;
00379 if ( pLink->pVNext )
00380 pLink->pVNext->pVPrev = pLink->pVPrev;
00381 pList->nItems--;
00382 }
00383
00384
00385
00386
00387
00399 void Fxu_ListDoubleAddPairLast( Fxu_Double * pDiv, Fxu_Pair * pLink )
00400 {
00401 Fxu_ListPair * pList = &pDiv->lPairs;
00402 if ( pList->pHead == NULL )
00403 {
00404 pList->pHead = pLink;
00405 pList->pTail = pLink;
00406 pLink->pDPrev = NULL;
00407 pLink->pDNext = NULL;
00408 }
00409 else
00410 {
00411 pLink->pDNext = NULL;
00412 pList->pTail->pDNext = pLink;
00413 pLink->pDPrev = pList->pTail;
00414 pList->pTail = pLink;
00415 }
00416 pList->nItems++;
00417 }
00418
00430 void Fxu_ListDoubleAddPairFirst( Fxu_Double * pDiv, Fxu_Pair * pLink )
00431 {
00432 Fxu_ListPair * pList = &pDiv->lPairs;
00433 if ( pList->pHead == NULL )
00434 {
00435 pList->pHead = pLink;
00436 pList->pTail = pLink;
00437 pLink->pDPrev = NULL;
00438 pLink->pDNext = NULL;
00439 }
00440 else
00441 {
00442 pLink->pDPrev = NULL;
00443 pList->pHead->pDPrev = pLink;
00444 pLink->pDNext = pList->pHead;
00445 pList->pHead = pLink;
00446 }
00447 pList->nItems++;
00448 }
00449
00463 void Fxu_ListDoubleAddPairMiddle( Fxu_Double * pDiv, Fxu_Pair * pSpot, Fxu_Pair * pLink )
00464 {
00465 Fxu_ListPair * pList = &pDiv->lPairs;
00466 assert( pSpot );
00467 assert( pSpot != pList->pTail );
00468 pLink->pDPrev = pSpot;
00469 pLink->pDNext = pSpot->pDNext;
00470 pLink->pDPrev->pDNext = pLink;
00471 pLink->pDNext->pDPrev = pLink;
00472 pList->nItems++;
00473 }
00474
00486 void Fxu_ListDoubleDelPair( Fxu_Double * pDiv, Fxu_Pair * pLink )
00487 {
00488 Fxu_ListPair * pList = &pDiv->lPairs;
00489 if ( pList->pHead == pLink )
00490 pList->pHead = pLink->pDNext;
00491 if ( pList->pTail == pLink )
00492 pList->pTail = pLink->pDPrev;
00493 if ( pLink->pDPrev )
00494 pLink->pDPrev->pDNext = pLink->pDNext;
00495 if ( pLink->pDNext )
00496 pLink->pDNext->pDPrev = pLink->pDPrev;
00497 pList->nItems--;
00498 }
00499
00511 void Fxu_ListDoubleAddPairPlace( Fxu_Double * pDiv, Fxu_Pair * pPair, Fxu_Pair * pPairSpot )
00512 {
00513 printf( "Fxu_ListDoubleAddPairPlace() is called!\n" );
00514 }
00515
00516
00517
00521
00522