| 336 | } |
| 337 | |
| 338 | resolvente liFindRes(lists L, int * len, int *typ0,intvec *** weights) |
| 339 | { |
| 340 | resolvente r; |
| 341 | intvec ** w=NULL,*tw=NULL; |
| 342 | |
| 343 | *len=L->nr+1; |
| 344 | if (*len<=0) |
| 345 | { |
| 346 | WerrorS("empty list"); |
| 347 | return NULL; |
| 348 | } |
| 349 | r=(ideal *)omAlloc0((*len)*sizeof(ideal)); |
| 350 | w=(intvec**)omAlloc0((*len)*sizeof(intvec*)); |
| 351 | int i=0; |
| 352 | *typ0=MODUL_CMD; |
| 353 | while (i<(*len)) |
| 354 | { |
| 355 | if (L->m[i].rtyp != MODUL_CMD) |
| 356 | { |
| 357 | if (L->m[i].rtyp!=IDEAL_CMD) |
| 358 | { |
| 359 | Werror("element %d is not of type module",i+1); |
| 360 | omFreeSize((ADDRESS)r,(*len)*sizeof(ideal)); |
| 361 | return NULL; |
| 362 | } |
| 363 | *typ0=IDEAL_CMD; |
| 364 | } |
| 365 | if ((i>0) && (idIs0(r[i-1]))) |
| 366 | { |
| 367 | //*len=i-1; |
| 368 | break; |
| 369 | } |
| 370 | r[i]=(ideal)L->m[i].data; |
| 371 | tw=(intvec*)atGet(&(L->m[i]),"isHomog",INTVEC_CMD); |
| 372 | if (tw!=NULL) |
| 373 | { |
| 374 | w[i]=ivCopy(tw); |
| 375 | } |
| 376 | tw = NULL; |
| 377 | i++; |
| 378 | } |
| 379 | BOOLEAN hom_complex=TRUE; |
| 380 | int j=0; |
| 381 | while ((j<i) && hom_complex) |
| 382 | { |
| 383 | hom_complex = hom_complex && (w[j]!=NULL); |
| 384 | j++; |
| 385 | } |
| 386 | if ((!hom_complex) || (weights==NULL)) |
| 387 | { |
| 388 | for (j=0;j<i;j++) |
| 389 | { |
| 390 | if (w[j]!=NULL) delete w[j]; |
| 391 | } |
| 392 | omFreeSize((ADDRESS)w,(*len)*sizeof(intvec*)); |
| 393 | if (weights!=NULL) *weights=NULL; |
| 394 | } |
| 395 | else |
no test coverage detected